Version: 2020.2
public static Rect GetLastRect ();

반환

Rect The last used rectangle.

설명

Get the rectangle last used by GUILayout for a control.

Note that this only works during the Repaint event.

using UnityEngine;

public class ExampleScript : MonoBehaviour { void OnGUI() { GUILayout.Button("My button"); if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition)) { GUILayout.Label("Mouse over!"); } else { GUILayout.Label("Mouse somewhere else"); } } }