I am making an isometric game with sprites. I decided to make the textures be loaded from the HDD at startup, so people can make their own textures, and it makes it easier to see of new textures are good looking.
I already implemented the possibility to load textures from the HDD, but whenever I load a texture, it is heavily compressed and looks really ugly, cropped, and streched out when using it in a GUI.DrawTexture.
So my question is, how can I change the texturetype when loading a texture from a WWW call? (GUI texture format, point filter mode, 4096 max size and truecolor format to be precise)
var textures : Texture2D[];
var textureNames : String[] = [ "/isometric UV2.png", "/isometric UV2blocked.png" ];
function Start()
{
StartCoroutine(DownloadTextures());
}
function DownloadTextures()
{
textures = new Texture2D[textureNames.Length];
for(var t=0; t<textureNames.Length; t++)
{
textures[t] = new Texture2D(4096, 4096, TextureFormat.DXT1, false);
// Start a download of the given URL
var www = new WWW("file://" + Application.dataPath + textureNames[t]);
// wait until the download is done
yield www;
// assign the downloaded image to the main texture of the object
www.LoadImageIntoTexture(textures[t]);
}
}
Now you can just add texture string names for each texture you wish.
The key is that WWW.texture enabled mipChain when construct Texture2D. So you need to construct a Texture2D which disabled mipChain manually and use WWW.LoadImageIntoTexture to load texture.