On unity3d website in the manual on this page: http://unity3d.com/support/documentation/Components/gui-Controls.html
I found an example of "GUI.changed" function usage(below). And it looks like it creates toolbar object on every frame. Am I right or not?
/* GUI.changed example */
// JavaScript
private var selectedToolbar : int = 0;
private var toolbarStrings = ["One", "Two"];
function OnGUI () {
// Determine which button is active, whether it was clicked this frame or not
selectedToolbar = GUI.Toolbar (Rect (50, 10, Screen.width - 100, 30), selectedToolbar, toolbarStrings);
// If the user clicked a new Toolbar button this frame, we'll process their input
if (GUI.changed)
{
print ("The toolbar was clicked");
if (selectedToolbar == 0)
{
print ("First button was clicked");
}
else
{
print ("Second button was clicked");
}
}
}
onGUI, notonUpdate, oronRenderor similar other things. so I can assume it's not creating GUI in every frame but only when one enters GUI enabled scene. \$\endgroup\$