Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main Thread #3

Open
nsmith1024 opened this issue May 14, 2019 · 1 comment
Open

Main Thread #3

nsmith1024 opened this issue May 14, 2019 · 1 comment

Comments

@nsmith1024
Copy link

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.

@hcq0618
Copy link
Owner

hcq0618 commented May 17, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants