In iGUI, you cannot see the control if Enable is set to false, but it is not removed. Today I will talk about how to add and delete the iGUI control in unity dynamically.
1. Add: iGUI. iGUIRoot. addElement ("iGUIProgressBar ");
2. Remove: iGUI. iGUIRoot. removeElement (iGUI. iGUIElement );
Let's take a look at my example:
[Java]
<Pre class = "html" name = "code"> var root: iGUI. iGUIRoot;
Var chun: iGUI. iGUIProgressBar;
Function OnGUI (){
If (GUI. Button (Rect (100,100,), "add ")){
Chun = root. addElement ("iGUIProgressBar"); // iGUIxxx must be written;
Chun. name = "chun ";
}
If (GUI. Button (Rect (0,110,100,100), "remove ")){
Root. removeElement (chun); // there must be no "". Otherwise, an error is returned.
}
}
Note: The chun of removeElement is var chun: iGUI. iGUIProgressBar; the chun in it is not chun. name = "chun ";
I didn't change the height of iGUIProgressBar in the past. Later I found that I should change the --> Fixed Height of Empty Style and Fill Style to 0 ~~~
From dlnuchunge's column