- Home /
Question by
Summer006_unity · Sep 19, 2019 at 02:53 PM ·
texture2dbackgroundbug-perhapsasynccreate a texture
issue with create texture2d in background Task, probably a bug ?
I create a few background tasks to get images from server and create texture2d. According to log: success to get image bytes, but failed to create texture2d.
here is my code :
public static Texture2D LoadTextureFromBytes(byte[] imgBytes) {
logger($"LoadTextureFromBytes: imgBytes.isnull: [{imgBytes == null}]");
if (imgBytes == null) return null;
logger($"LoadTextureFromBytes: 22 ");
Texture2D texture = new Texture2D(2, 2, TextureFormat.ARGB32, false);
logger($"LoadTextureFromBytes: loadImage: [{imgBytes}]");
texture.LoadImage(imgBytes);
logger($"LoadTextureFromBytes: texture: [{texture}]");
return texture;
}
here is log:
looks like when execute "new Texture2D", that thread dead, dispeared, gone, without any warning or error.
tested on 2019.2.4 and 2.6
wx20190919-224718.png
(63.0 kB)
Comment