Hi there,
I would like to use “loadExternalImage” from web player and send him the url where to find the image.
here is the javascript in the webplayer:
unityObject.getObjectById("unityPlayer").SendMessage("housse_avant", "Start", "http://www.myUrl.net/housse.jpg");
here’s the javascript in unity :
// Load image
function Start (url: String) {
// 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);
//}
}
Why I want to do this is because the user must be able to upload his texture which I give a random name that will be sent to unityPlayer.
Any idea?
Cheers.