Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Update is called once per frame
- void OnGUI ()
- {
- //gui version
- var rect = new Rect (0, 0, Screen.width*0.2f, Screen.height*0.2f);
- if (GUI.Button(rect, "left"))
- {
- }
- //layout version (worse)
- if (GUILayout.Button ("crud", GUILayout.Width(200), GUILayout.ExpandHeight(true)))
- {
- }
- var rect = GUILayoutUtility.GetLastRect();
- //detect mouse in the screen rect of the button
- if (/*Event.current.type.Equals(EventType.MouseUp) && */rect.Contains(Event.current.mousePosition))
- {
- Debug.Log ("mouse");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement