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"); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961