OnGUI

OnGUI is called for rendering and handling GUI events, such as GUI.Button, GUI.Label, GUI.Box, and so on.

This means that your OnGUI implementation might be called several times per frame (one call per event). If the enabled property of MonoBehaviour is set to false, OnGUI will not be called.

Example

// Draw the Button (width = 150, height = 50) at the position x = 10, y = 10. 
function OnGUI () {
  if (GUI.Button(Rect(10, 10, 150, 50), "My Button")) {
    Debug.Log("Hello World");
  }
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.171.125