GetLastRect()
Get the rectangle last used by GUILayout for a control.
阅读时间1 分钟最后更新于 1 个月前
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.IMGUIModule
public static Rect GetLastRect()
Returns
Type | Description |
|---|---|
| Rect | The last used rectangle. |
Remarks
Note that this only works during the Repaint event.
Examples
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"); } }}