- Home /
Question by
ThreeDForYou · Mar 01, 2012 at 09:32 PM ·
guihowto
Exiting witha GUI Button
okay hello, i was just wondering i have found a code and it works good but it doesnt exit the map when i click the GUI button, is there anyway i could do this so that when i click the GUI button again the "Map" would disappear ??
var myBox : Transform;
function Start() { myBox.renderer.enabled = false; // hide it }
function OnGUI() { if (GUI.Button (Rect (10, 10, 100, 20), "Map")) myBox.renderer.enabled = true;
}
Comment
Best Answer
Answer by DaveA · Mar 01, 2012 at 10:01 PM
var myBox : Transform;
var showMap = false;
function Start()
{
myBox.renderer.enabled = false; // hide it
}
function OnGUI()
{
showMap = (GUI.Toggle (Rect (10, 10, 100, 20), showMap, "Map");
myBox.renderer.enabled = showMap;
}
Your answer
Follow this Question
Related Questions
activating a box using a GUI button 1 Answer
Delaying GUITexture!!! 3 Answers
Collider Animation 1 Answer
Animation Help!!!!! 1 Answer
I need help with my pause menu 1 Answer