ドキュメント

Unity Engine

Unity Engine

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

RectThe 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"); } }}