Struct for returning control events instead of booleans

It would be great to have a struct to be returned when e.g. pressing a button or other control element,
instead of a boolean. With other controls, like a textfield, there could be different events.

E.g:

result=GUI.Button(Rect(0,0,50,20), "Wow");

“result” then is fed with one of each button mouse events (struct):

GUIResult.LEFTCLICK
GUIResult.RIGHTCLICK
GUIResult.LEFTRELEASE
GUIResult.RIGHTRELEASE
GUIResult.OUT
GUIResult.ENTER
GUIResult.MOVE
GUIResult.LEFTDOUBLECLICK
GUIResult.RIGHTDOUBLECLICK

You mean an enum?

This isn’t a bad idea, though backward compatibility would be an issue. I wonder if it’s possible to give an enumeration the ability to implicitly convert itself to a boolean?

Uhm, yeah, enum :slight_smile:

Perhaps it could be made backward compatible, so that the most logical event (e.g mouseclick for buttons) is still returned as a boolean, I think you describe that as well?

Check this out:

http://forum.unity3d.com/viewtopic.php?t=12506&highlight=hoverbutton