Hide SHow Object // Help

Hello

I need to make two button that player can with it Hide an object and Show an other object with the second button.
so object one should be visible and object two should be hidden in the first time then player can hide object one and showing object two with the button. (( object one and two are in the same place ))

this is a script that i trying to work with it

[var someGameObject1 : GameObject;
var someGameObject2 : GameObject;
function OnGUI () {

if(GUI.Button(new Rect(15, 60, 95, 35), “Obj1”))
{

if(someGameObject1.active == true)
{
someGameObject1.active = false;
someGameObject2.active = true;
}
else
{
someGameObject2.active = false;
someGameObject1.active = true;
}

}
} ]

but when i click the button object one is gone and the button also gone. and the object two ara visible from the first time. how can we fix that. thanks[/code]

My humble advice is to seperate the draw logic from the check-if-active logic. Use a toggleon/of function that sets a boolean that you call from your GUI code and use a loop in update() to set the objects .enable value.

Good luck

/Chris