Unity GUI Button - Polling Input VS Event Driven Input
I am learning Unity with C# and studying the GUI Button. I found the following statement in Unity documentation: "This means that your OnGUI implementation might be called several times per frame (one call per event). " using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnGUI() { if (GUI.Button(new Rect(10, 10, 150, 100), "I am a button")) print("You clicked the button!"); } } My questions are: 1) The above "if" statement will keep detecting the condition until it is true. It should be called polling input. Why does the above code use polling input