Hey guys! I tried using www.LoadImageIntoTexture today, but all I got was a grey or really weird texture.
My code:
var url : String;
private var loaded : boolean = false;
var texture : Texture2D;
function OnGUI () {
if(!loaded) {
GUI.Label(Rect(20,20,300,20), "Enter the image url below and click load");
url = GUI.TextField(Rect(20,40,Screen.width-40,20), url);
if(GUI.Button(Rect(20,60,300,20), "Load")) {
loaded = false;
LoadImage();
}
}
GUI.DrawTexture(Rect(20,80,100,100), texture, ScaleMode.StretchToFill);
}
function LoadImage () {
texture = new Texture2D(16,16, TextureFormat.RGB24, false);
while(true) {
var www : WWW = WWW(url);
yield www;
}
www.LoadImageIntoTexture(texture);
}
Any ideas?
– David