기술 자료

Unity Engine

Unity Engine

GetLastRect()

Get the rectangle last used by GUILayout for a control.
읽는 시간 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"); } }}