x


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 ); } }

more ▼

asked Jun 16 '11 at 08:25 PM

darkcookie gravatar image

darkcookie
294 16 25 32

You want the button to disappear after you click it?

Jun 16 '11 at 08:30 PM flaviusxvii

yes:))))))

Jun 16 '11 at 08:40 PM darkcookie
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first
var apple : GameObject;
var showGUI = true;

function OnGUI()
{
 if (showGUI)
 {
  if ( GUILayout.Button( "Destroy Cube") )
  {
   showGUI = false;
   Destroy( apple );
  }
 }
}
more ▼

answered Jun 16 '11 at 08:54 PM

DaveA gravatar image

DaveA
26.5k 151 171 256

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.

Jun 17 '11 at 04:25 AM flaviusxvii
(comments are locked)
10|3000 characters needed characters left

thank you so much:)

more ▼

answered Jun 16 '11 at 09:01 PM

darkcookie gravatar image

darkcookie
294 16 25 32

For the love of all that is good in this world STOP using answers as comments!

Jun 17 '11 at 04:24 AM flaviusxvii
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3697
x3340
x764
x109
x15

asked: Jun 16 '11 at 08:25 PM

Seen: 770 times

Last Updated: Jun 17 '11 at 04:25 AM