Hi experts.
I use JS and IMGUI to create a huge list of objects. Each object presents by four labels, one button and one box. I have array of these objects. When array populated or element of array is changed, I calculate new values for labels’ strings ONE time. But OnGUI() function works all time.
Is there a way to refresh the screen only when my array is changed?
Could someone help me? Thanks.
Create a boolean variable something like this
var guiIsDirty : bool = true; // set this to tue initially so first time the GUI is drawn
Now anytime you modify a GUI object set guiIsDirty to true.
Next inside OnGui do this
function OnGUI ()
{
if (guiIsDirty == true)
{
// move the bulk of OnGui code here
}
guiIsDirty = false;
}