hi guys,
I got a problem. I want detect the event when the right mouse button hit a GUILayout.Button.
here is my code:
void OnGUI()
{
for(int i=0; i<4; ++i)
{
GUILayout.Button("button"+i) ;
if(Event.current.button == 1 Event.current.type == EventType.MouseDown
GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
{
Debug.Log("mouse right button hit it!");
}
}
}
It’s not work. Do you know how to do it? please help.
Thank you very much.