in unity 2.6 it was perfectly possible to load image data from the web with the www class, create a compressed texture2d and assign the data via LoadImageIntoTexture ( sizes are power of two, all less or equal 2048 ) ( mac os x 10.5):
Texture2D tex = new Texture2D(Convert.ToInt32(resized_imgWidth),Convert.ToInt32(resized_imgHeight), TextureFormat.DXT1, false);
resImg.LoadImageIntoTexture(tex)
BUT with unity 3+, the creation of texture2d fails with the following exception:
"Failed to create texture (can't create with compressed format)."
can anyone give me a hint on that ?
thanks and best regards,
doron goldfarb
Have you tried Texture2D.Compress? I haven't tried it myself, but from the docs it looks like you should create the texture as RGB24, and it will be converted to DXT1 after Texture2D.Compress is finished.
Texture2D tex = new Texture2D(Convert.ToInt32(resized_imgWidth),Convert.ToInt32(resized_imgHeight), TextureFormat.RGB24, false);
resImg.LoadImageIntoTexture(tex)
tex.Compress()
I just investigated this problem. It seems that this is a bug we introduced in 3.0. This came from merging in the iPhone code base, which was based on Unity 1.x, which could not modify compressed textures yet. Sorry for the inconvenience, I will file myself a bug so it gets fixed.