Stuck using unity LoadImage

295 Views Asked by At

I get an image from internal memory and load image using LoadImage but this LoadImage function feels heavy and causes my runtime to be stuck for 1 second.

 public Texture2D GetTexture() {
    var bytes = File.ReadAllBytes(path);
    var texture = new Texture2D(2,2, TextureFormat.RGBA32, false);
    texture.LoadImage(bytes);
    return texture; 
 }

What's the best way to load an image and not be stuck when using it?

0

There are 0 best solutions below