Forum Discussion

SylGames's avatar
SylGames
Member
9 months ago
Solved

Loading Custom UI images doesn't work

Hello everyone,

I've been working on custom UIs and encountered an issue that's quite frustrating. Whenever I try to load an ImageSource from an asset, the image often fails to display. This problem occurs with any image, and once it happens, the image won't load for the duration of the session and sometimes even after.

The only workaround I've found is to leave the editor for a few hours, but when I return, the issue reappears with different images.

This might be related to this post published a few days ago. Has anyone else experienced something similar?

 

Thank you

  • Can you share the code that you are using to display the image? How frequently are you changing these images?

    Also, how large are the images? How many megabytes? Switching large images might eventually fail to load due to a memory limitation.

    Is the script running locally or on the server? Sometimes images fail to load on local scripts, if they are not rendered on the server side first when the CUI is initialized. 

3 Replies

  • Can you share the code that you are using to display the image? How frequently are you changing these images?

    Also, how large are the images? How many megabytes? Switching large images might eventually fail to load due to a memory limitation.

    Is the script running locally or on the server? Sometimes images fail to load on local scripts, if they are not rendered on the server side first when the CUI is initialized. 

  • As pigeon mentioned earlier, no asset loads can be _initiated_ by local scripts, and that includes swapping textures or materials onto meshes, or loading image assets in to custom ui.  The asset in question must _previously_ have been loaded into the world by a server side 'default' script before any local script can attempt to use it.  I'd recommend having a 'default' script pre-loader that loads up all the TextureAsset and MaterialAssets at world start that you eventually plan to use from local scripts.

  • Thank you very much PigeonNo12 Shards632 . You were right, the textures have to be first loaded by the server. It's something I was trying to avoid to only load what's going to be used, so I'll have to work on that.

    Have a great day!