Hi guys. Im curious. Assuming i have something simple such as a custom editor window with a toggle set up to turn on or off a light... if im correct, the OnGUI happens with each action, for eg movement of the mouse on screen, etc. So i noticed that Debug.Log will tell me with each stroke of the mouse over and over "lights off" after i toggle 'turn off' the lights, and i got to thinking, is it really running a routine each and every single frame OnGUI does something? Attempting to turn off all the lights again and again.... it just doesnt seem optimal, so i assume im doing something completely wrong. thanks, bit newish here.
It's run every frame, but can be multiple times per frame as it is run for every input event that happened that frame too.
Yeah, it will assign fields every frame. If you are using a public property to call a function, you should check whether the value has changed first.