Unity-ImageLoader icon indicating copy to clipboard operation
Unity-ImageLoader copied to clipboard

Main Thread

Open nsmith1024 opened this issue 5 years ago • 1 comments

My Unity app loads lots of large images from a server, this causes Unity to freeze while decoding and rendering the image becuase this is all done on the main thread.

Does your code still use the main thread to load the images onto textures?

To test have a code like this

void Update() { transform.rotate(Vector3(1,0,0)* Time.deltatime*10); }

Run that while loading several images using your code, see if the object being rotated ever pauses and then resume rotation.

nsmith1024 avatar May 14 '19 00:05 nsmith1024

yes, just like #2 said: Texture2D texture = new Texture2D(width, height, TextureFormat.ARGB32, false); texture.LoadImage(data);

It could be done in a thread when decoding and rendering images, but I have no time to do and test it. You can finish this on a new PR. I appreciate that.

hcq0618 avatar May 17 '19 08:05 hcq0618