system
1
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?
Sidar
2
Why aren’t you just keeping the texture in a variable and load it in the start function, but then use the variable in the update function to assign the material texture?