If I create an instance in “function Start” and give it a texture like below it works:
function Start () {
var instance : GameObject = Instantiate(Resources.Load("103")) as GameObject;
instance.renderer.material.mainTexture = Resources.Load("entextur");
}
…But if I do the same thing in a “function Update” it doesnt. Like this:
function Update () {
if(Input.GetMouseButtonDown(0) Input.mousePosition.y < 200){
var instance : GameObject = Instantiate(Resources.Load("103")) as GameObject;
instance.renderer.material.mainTexture = Resources.Load("entextur");
}
}
Why doesnt it work and how do I make it work?