Hi! I'm makin a house editor for my website.
I am trying to change the texture of all walls of the house by pressing a button.
Look what I've done:
if (GUI.Button (new Rect (260,520,70,70), texparede[1])) {
for (var wall:GameObject in GameObject.FindGameObjectsWithTag("wall")) {
wall.gameObject.transform.Find("parede").renderer.material.mainTexture=texparede[1];
}
}
It isn't working!
It works only for the first wall i created to my house. How can i do to change the texture of alllll GameObjects Found With Tag =="wall" ?? ???
P.S.:The "parede" is an object which can be found inside the tagged as wall, it's where the texture is applied. Thanks!
Thanks for help!
Regards. Henry