I find the Unity way of writing the GUILayout.Button in onGUI to check for button click to contract the way I am used to seeing UI code, in which you instantiate a UI object and set up a click event handler for it. What’s the reasoning behind doing it this way (from a framework creator’s viewpoint)?
function OnGUI {
if (GUILayout.Button("Play")) {
// button clicked
}
}
I think this site is more for "how" questions than "why" questions. But I also think OnGUI is the event handler, and it's already been set up, internally. Right? So there you go.
– KiloblarghI would assume its faster to check for the buttons that you are interested in as needed, rather than scanning all input and firing individual methods, but I could be wrong.
– Kronusdark