I wanted to created a special GUI.Box() function, called _BOX().
What it would do is that instead of having a box appear, it would have it’s own fancy animation that would resize itself automatically, basically how the pop up windows work in Super Mario World.
The problem is that the function needs to repeatedly resize itself, but now that the function would be called in OnGUI(), an UPDATE function, it would cause super-lag.
function _BOX(rect:Rect,s:String){
GUI.Box(rect,s);
//see? to put a 'for' loop right here would cause massive lag,
//due to the fact that this function will be called in an OnGUI, but not doing so only results in the GUI box to just resize by one pixel.
//i do not want to have two variables outside of this function either, it's not too efficient as i will call this _BOX function many times
rect.width += 1;
rect.height += 1;
}
function OnGUI(){
_BOX(new RectC(200,100),"Hello World!"); //ignore my RectC function
}