- Home /
Why events only work with OnGUI?
I only need an explanation why can't events work with, for example, function Update?
Answer by whydoidoit · Mar 12, 2014 at 03:04 PM
The events system is only initialized for OnGUI which is called multiple times for each of the different types of event. The Update function is only called once per frame and the preparatory work for events has not been created at that time. The inclusion of OnGUI code causes this to happen (with expected performance penalties).
Just making sure if I get this right: It's to make sure that you can get as much as needed event updates per frame?
It's so you don't impact performance when you are not using the GUI. OnGUI is quite slow.
Your answer
Follow this Question
Related Questions
How do I add an event listener for the WWW class? 1 Answer
NSEvents and Unity 0 Answers
Get OnMouseUp event in other object's script 1 Answer
Rotation Change 1 Answer