for example:
I add one gui.box in ongui() function
how can i disposal it all?
If I decided not to use if(){} function?
you could move it somewhere outside of the screen, or you could make it transparent, but i don’t get why you would have to avoid if’s
Because when i change the caption of gui.box by click the button,its ok
but when I change it in function instead of click.
Even if I use the same code.there is new one showen and the old gui.box behind.
you are probably creating a second box, if i understand your problem correctly.
if you post some of your sourcecode, someone could help you more specifically
The sourcecode of example is quite simple
void ongui()
{
gui.box(new rect(…),“string”)
}
now I need this box be disposaled
you can’t delete that box, because the OnGui function is called every frame, that means even if you delete the box, it gets redrawn the next frame.
what you want to do is something like this (in javascript)
function OnGUI() {
if(someBooleanVariable)
{
gui.box(new rect(....),"string");
}
else
{
//don't draw
}
}
if you set “someBooleanVariable” to true, the box will be drawn, if it’s false, it won’t be drawn
I see,If I want to use “disposal” function
I need to define one segment to dentify whether to show it or not