Hello,
I am making a scene where the user can choose between 3 options. Each of these options is a GameObject with a few childnodes. And what i wand is in scripting to make the parent GameObject visible or not.
Here is my code
void Start () {
opt1 = GameObject.Find("AB01");
opt2 = GameObject.Find("AB02");
opt2 = GameObject.Find("AB03");
}
void OnGUI () {
toolbarInt = GUI.Toolbar(r, toolbarInt, toolbarStrings);
if (GUI.changed)
{
opt1.active = false;
opt2.active = false;
opt3.active = false;
switch (toolbarInt)
{
case 1:
opt1.active = true;
break;
case 2:
opt2.active = true;
break;
default:
opt3.active = true;
break;
}
}
}
Problem is that in my Hierarchy view the do go on and of but in the view they are still visible.
Now i think its because i need to turn off all the childnodes as wel. But i like to now if there is a easier way to do this?
Thanx in advance…