- Home /
GUI after pressed Destruction
how can I destroy (permanantly in game...but not in the Hieriachy) my GUI after pressed?
my button script is
var apple : GameObject;
function OnGUI() { if ( GUILayout.Button( "Destroy Cube") ) { Destroy( apple ); } }
Answer by DaveA · Jun 16, 2011 at 08:54 PM
var apple : GameObject;
var showGUI = true;
function OnGUI()
{
if (showGUI)
{
if ( GUILayout.Button( "Destroy Cube") )
{
showGUI = false;
Destroy( apple );
}
}
}
I can't tell if darkcookie is serious or not. I would have typed this out, but it's like.. like he wins if we give in.
Answer by darkcookie · Jun 16, 2011 at 09:01 PM
thank you so much:)
For the love of all that is good in this world STOP using answers as comments!
Your answer
Follow this Question
Related Questions
how can i destroy a cube when i press a gui button??? 1 Answer
GUI text help with adding numbers 2 Answers
Unity freezes when changing GUI.Color.a 1 Answer
Re Enable C# script on camera 1 Answer
Create GUI button in update function? 3 Answers