- Home /
Webplayer crash on LoadImageIntoTexture call
Hi everyone,
I am having hard times with LoadImageIntoTexture fonction on webplayer. While it is working just fine on editor mode, it simply crashes the webplayer.
Here is the code of the function where it is used. The var "chemin" is a web adress.
It crashes on first call, it is a very small image.
function AssigneTextureIcone(chemin :String)
{
//Debug.Log("AssigneTextureIcone");
// Start a download of the given URL
var twww = new WWW(chemin);
// wait until the download is done
yield twww;
// assign the downloaded image to the main texture of the object
twww.LoadImageIntoTexture(iconeBase);
}
Does anyone experienced this issue or had an idea of where it comes from ?
Thanks !
Answer by Leonidax · Jul 01, 2011 at 04:18 PM
Have you created the texture? I mean I think that iconeBase should be defined
// Continuously get the latest webcam shot from outside "Friday's" in Times Square
// and DXT compress them at runtime
var url = "http://images.earthcam.com/ec_metros/ourcams/fridays.jpg";
function Start () {
// Create a texture in DXT1 format
renderer.material.mainTexture = new Texture2D(4, 4, TextureFormat.DXT1, false);
while(true) {
// Start a download of the given URL
var www = new WWW(url);
// wait until the download is done
yield www;
// assign the downloaded image to the main texture of the object
www.LoadImageIntoTexture(renderer.material.mainTexture);
}
}
Or you can try by using
iconBase = twww.texture;
Yes, iconeBase is define, it is a texture that is white ^^ I think it won't work in the editor either if I hadn't. But thanks for the answer anyway :)
I'll try the www.texture !
www.texture is not working at all :-/ $$anonymous$$y texture (that is used on the GUI) remains blank, even in the editor.
Have you tried by checking with isDone every time that the Update method is called...
http://unity3d.com/support/documentation/ScriptReference/WWW-isDone.html
I wanted to move on (because there are so much things to do) so I have decided to keep the texture locally for the moment ^^