Hi.
I noticed a few days ago that the OnGUI fuction updates way more than 1 time per frame. As a build in feature, why does it act that way? Like, would a update once a frame not be enough?
Hi.
I noticed a few days ago that the OnGUI fuction updates way more than 1 time per frame. As a build in feature, why does it act that way? Like, would a update once a frame not be enough?
As it says here: http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.OnGUI.html
see here:
http://unity3d.com/support/documentation/ScriptReference/Event.html
which leads here:
http://unity3d.com/support/documentation/ScriptReference/EventType.html
Basically, it may go through several phases (event type) for doing layout, input, render, etc.
It depends on your code, but it has to do it at least twice because of getting the positions for things and then doing the actual layout. It’s not arbitrarily running the code more than once.
Is there a way to use OnGUI just for drawing, such as DEBUG GUI which I use it for, and have it do it once per frame?
– Xonatron