Hi.
Just need help to hide a 3D object with button (GUI.Button)
and show a new one.
in other words…
there are a 3D object rotating on my escene
and I already have a GUI.Button on screen
i need when user press this GUI.Button
the first object disappears, and instead a new one appears.
some body have some code to doit please
or some idea how to do this please ?
any help will be apreciate.
thanks a lot. !
You should be able to search your answer out on this one.
However here is some untested, mostly pseudo code.
void OnGUI()
{
if(GUI.Button(new Rect(180, Screen.height-120, 120, 40), "Some Button Text"))
{
if(someGameObject1.active == true)
{
someGameObject1.active = false;
someGameObject2.active = true;
}
else
{
someGameObject2.active = false;
someGameObject1.active = true;
}
}
}
This totally can be done with other ways, switch and all that. But here there is a kinda sorta example.
thanks you
Now is working !