I try to generate sprites from StreamingAsets folder but I'm stuck when it comes to create texture from formats other than PNG and JPG. Following code:
byte[] bytes = File.ReadAllBytes (filepath); // 256x256 .tga image file
Texture2D texture = new Texture2D (1, 1);
texture.LoadImage (bytes);
generates 8x8 texture which is:
- wrong considered my image is 256x256,
- expected, since Texture2D.LoadImage is meant to work with PNGs and JPGs.
So how do I create textures from other types of images?