Hi,
Im trying to load a texture/rawTexture from a byte array.
testimg = new Texture2D(512,256,TextureFormat.RGBA32,false);
testimg.LoadRawTextureData(tinc.IncidentPhoto.ToArray());
testimg.Apply();
InfoWindow.transform.Find("Image").GetComponent<Image>().overrideSprite = Sprite.Create(testimg, new Rect(0, 0, testimg.width, testimg.height), new Vector2(0.5f, 0.5f),100f);
I recived this image:
I would guess the TextureFormat.RGBA32 and IncidentPhoto.ToArray() format do not match.
According to the documentation, “it is mostly useful for loading compressed texture format data”. In this case I assume IncidentPhoto.ToArray() returns a byte array of said compressed texture data and in this case the Texture2D you created uses an uncompressed format.
Another idea would be that perhaps the mip-map count is different, between the texture you create and the data you apply.