UIElement Background Image Path
-
- English
- yahwho
- Thread is marked as Resolved.
-
-
I got the same error, so I just packed assets together with plugin - assets can be loaded from folder correctly
-
-
You mean like:
Plugins/PluginFolderName/PluginNamePlugins/PluginFolderName/PluginName/res/text.jpg
Yes, something like this. I build my plugin with gradle, so I just added instruction to pack all assets together with plugin jar. You can see how resulting zip looks like here, the user just need to unpack it into plugin folder
-
Loading from plugin resources is broken atm unfortunately But we try to get it fixed with the upcoming hotfix However, loading from a file (e.g. from plugins folder), url, asset bundle or raw byte data should still work.
-
Hehe I'm a hobbiest programmer, so not sure what gradle is
In the Java version I did this:
I've just had a good with this:
Now I don't get an error messages, in fact I get a "Loading asset (Texture) from cache: D:\MR2\Plugins\MedievalRealms\res\test.jpg" from the console, so it finds the file.
However, when I log into my test server the images are missing (transparent bg).
-
Loading from plugin resources is broken atm unfortunately But we try to get it fixed with the upcoming hotfix However, loading from a file (e.g. from plugins folder), url, asset bundle or raw byte data should still work.
Oooh so ..
Should work in the future? I would very much like to keep all the assets bundled up in the same jar
Thanks for the reply Red Legend.
-
Your code is correct, and the file can be loaded from a plugin .jar indeed, it's just that the data isn't properly synced with the client apparently (due to a bug). This will be definitely fixed soon
-
Sorry, so in the meantime if I use loadFromFile what does the string look like?
On the assumption the resource is in a res folder in the Plugins directory
Plugins/MedievalRealms/res
-
Oh, sorry, I misunderstood your previous message Actually TextureAsset.loadFromFile(plugin.getPath() + "\\res\\test.jpg"); should already work (if there is a "res" folder in your plugin dir) If the image doesn't show up, there is likely another reason for that (e.g. maybe another style setting causing the image to be transparent or something like that) Could you maybe post your style code here (or send it via PM to me)?^^
Participate now!
Don’t have an account yet? Create a new account now and be part of our community!