- Home /
Coroutine and set (big?) Texture / Sprite gets noticable Lag
Hello to All !
I would like to share with you an issue that i have to manage.
Specifically, i load some images from a local path (pc, handled device etc) then I use the function WWW with only a string argument of the corresponding path of image which is png type. The size of that image exceeds 2mb and the Dimensions are 3000x1500.
Afterwards i continue by loading the texture into Image canvas object either by setting maintexture = www.texture or by creating new Sprite and setting sprite = Sprite.Create(www.texture.....)
I have noticed that the above process takes much time so i put the procedure in coroutine.
The problem is that i can't decouple the code so i can achieve the benefits of yielding and come through lags. Can we extend,override set mainTexture or setSprite functions ?
Generally how can we coroutin(ing) - yielding intensive monobehaviour operations?
I have tried to reduce the size of image, programmatically with GetPixelBilinear but the problem has shifted there and not solved.
Thanks in advance for your suggestions.