When my Android game is started, 3 images are loaded from the internet and are placed on planes like this:
private var image1: WWW;
private var image2: WWW;
private var image3: WWW;
public var Images: GameObject[]
function Start ()
{
image1 = new WWW ("image1.png"); yield image1;
Images[0].renderer.material.mainTexture = image1.texture;
image2 = new WWW ("image2.png"); yield image2;
Images[1].renderer.material.mainTexture = image2.texture;
image3 = new WWW ("image3.png"); yield image3;
Images[2].renderer.material.mainTexture = image3.texture;
}
This script is called loadingImages.js
That’s working fine.
But if I call this function Start() from another script like this:
loadingImages.Start();
I get the error WWW is not ready downloading yet.
Why is yield image1 etc. only working when the game is started but not when the function Start() is called from another script?