asynchronous Texture Operations

Not sure if it’s the right forum, but still 2d related, and hope that the 2D team can do something.

We are lacking of asynchronousmethods for textures operations
Most important for me right now is the Texture2D.LoadImage that block the mainthread.
When you’re trying to read jpg from the disk and display them in a gallery or something like that, it’s really hard on the framerate…

Any plan on this ?

By the way, here is a link to the feedback repo: http://feedback.unity3d.com/suggestions/async-texture2d-dot-loadimage-and-other-texture-operations

Thanks

Load the image as a byte array or whatever and process that in a thread, then create an empty texture or a grid of smaller ones, then upload one part at a time each frame.

This feature is on our roadmap, and we hope to have it available soon.

I already load byte array, from File.ReadBytesFromFile.
How will you process, to just update a part of a texture from another thread ?
You can’t access UnityEngine methods, like setPixels from another thread… or am I missing something ?

Great ChuanXin :slight_smile: Any timetable ?

well you can do it on the main threat still but if you break it up into small chunks you can just upload a small chunk each frame which is better, or upload a small chunk to a small texture (grid of textures) each frame. In Unity5 the SetPixels commands include a definable rectangle which helps somewhat to cut down on how much is uploaded.

Allright. Thanks for the tips.
I’m not a pro with bytes… is it possible to read bytes and transform it into a Color array ?