UrhoSharp assets on Android platform


I'm working on an app that uses the UrhoSharp lib in Android platform. I'm not able to get my resources from the Assets/Data folder. I don't know what I'm doing wrong... These are the steps that I followed:

  • I added the png image in the "Assets/Data" folder on my Android project. That image has the "AndroidAsset" build action and "Copy to output directory" as "Copy if newer".
  • On the PCL project I use the following line to initialize the Urho3D engine: UrhoSurface.RunInActivity(new ApplicationOptions("Data")) after the UrhoEngine.Init().
  • And from my code I try to access my resource with the following line: ResourceCache.GetSprite2D("MyImage.png", true) and the answer is always a null.
  • If I try to get a resource from "CoreData" folder, I don't have any problem and I can get it. (ResourceCache.GetSprite2D("Textures/Spot.png", true) for example...)

I don't know what to do. For sure, I'm don't know what I'm doing wrong... Some help will be very appreciated. THANKS!

Best Answers


  • MihaMarkicMihaMarkic SI ✭✭✭✭

    You don't need Copy if newer. Set to Do Not Copy instead. Doubt that this will help but who knows.

  • Thanks for the answer. But it did not solve my issue. I still get a ResourceNotFound event.

    The UrhoSurface.RunInActivity and UrhoEngine.Init lines come from the Android project and not from the PCL as stated in my first comment... Sorry for the errata.

  • Solved! Many thanks for the answer. It's just what happened. The application derived class MUST have a constructor that accepts ApplicationOptions argument if you want to have an "Assets/Data" folder of your own. :)

Sign In or Register to comment.