Hiccups when loading images from resources folder

Hi! At some point in my game, I need to display some simple 2D animations which are made from several sprites (some of them quite big) that I translate/rotate/scale around the scene following a script. All the sprites are located in the resources folder.

At the moment, I’m preloading the first few sprites I need and then I load the rest in a co-routine that executes along with the animation playback so that the rest of the sprites can be ready when needed. Although this method works, the main problem I’m facing is that the application suffers a hiccup when the co-routine calls Resources.Load, which can be quite noticeable.

I’ve been searching around unity answers and, to the best of my understanding, there’s no way to invoke Resources.Load as an asynchronous function. In fact, there seems to be a request for such a feature.

I’ve also tried the approach suggested in this thead but, just like the original poster, I’m also experiencing hiccups when loading big images.

I’ve changed my coroutine approach and replaced it with threads using this handy library but, again, the hiccups are still there.

Can you suggest any way to get rid of the hiccups? Thanks in advance for your help!

Cheers,

–Nacho

1 Answer

1

Note … for 2016 Unity have recently added LoadResourceAsync which can be relevant.


Tragically there is no solution to this in the current version of Unity.

We have investigated this every way and the fact is Unity is not good at streaming in big images. (It’s fine at getting big sounds from disk!)

Here’s one of many questions about it …

(Note for example the “WWW” class approach … you can and should try that but … it also hiccups.)

You can’t load large images on the fly in Unity – it is how life is for now.

Thank you for your reply. It's really unfortunate that there's no way to stream image data asynchronously! Oh well, I guess we'll have to work around that. Thanks again for your input!

–

The big problem is probably the upload to the GPU right? That and all the screwing around with writability etc.

–

Do you anims run smoothly with AsyncLevelLoad? Mine glitch still :S

–