docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class GUIState

    An implementation of an IGUIState that represents a generic GUI state.

    Inheritance
    object
    GUIState
    Implements
    IGUIState
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEditor.U2D.Path.GUIFramework
    Assembly: Unity.2D.Path.Editor.dll
    Syntax
    public class GUIState : IGUIState

    Properties

    changed

    Indicates whether the GUI has changed.

    Declaration
    public bool changed { get; set; }
    Property Value
    Type Description
    bool

    clickCount

    The current number of mouse clicks.

    Declaration
    public int clickCount { get; set; }
    Property Value
    Type Description
    int

    commandName

    The name of the current event's command.

    Declaration
    public string commandName { get; }
    Property Value
    Type Description
    string

    eventType

    The type of the current event.

    Declaration
    public EventType eventType { get; }
    Property Value
    Type Description
    EventType

    hotControl

    Hot Control

    Declaration
    public int hotControl { get; set; }
    Property Value
    Type Description
    int

    isActionKeyDown

    Indicates whether the action key is pressed.

    Declaration
    public bool isActionKeyDown { get; }
    Property Value
    Type Description
    bool

    isAltDown

    Indicates whether the alt key is pressed.

    Declaration
    public bool isAltDown { get; }
    Property Value
    Type Description
    bool

    isShiftDown

    Indicates whether the shift key is pressed.

    Declaration
    public bool isShiftDown { get; }
    Property Value
    Type Description
    bool

    keyCode

    The KeyCode of the currently pressed key.

    Declaration
    public KeyCode keyCode { get; }
    Property Value
    Type Description
    KeyCode

    mouseButton

    The currently pressed button.

    Declaration
    public int mouseButton { get; }
    Property Value
    Type Description
    int

    mousePosition

    The current mouse position.

    Declaration
    public Vector2 mousePosition { get; }
    Property Value
    Type Description
    Vector2

    nearestControl

    The closest control to the event.

    Declaration
    public int nearestControl { get; set; }
    Property Value
    Type Description
    int

    Methods

    AddControl(int, float)

    Adds a control to the GUIState.

    Declaration
    public void AddControl(int controlID, float distance)
    Parameters
    Type Name Description
    int controlID

    The ID of the control to add.

    float distance

    The distance from the camera to the control.

    DistanceToCircle(Vector3, float)

    Measures the distance to a circle.

    Declaration
    public float DistanceToCircle(Vector3 center, float radius)
    Parameters
    Type Name Description
    Vector3 center

    The center of the circle.

    float radius

    The radius of the circle.

    Returns
    Type Description
    float

    Returns the distance to a circle with the specified center and radius.

    DistanceToSegment(Vector3, Vector3)

    Measures the GUI-space distance between two points of a segment.

    Declaration
    public float DistanceToSegment(Vector3 p1, Vector3 p2)
    Parameters
    Type Name Description
    Vector3 p1

    The first point.

    Vector3 p2

    The seconde point.

    Returns
    Type Description
    float

    Returns the GUI-space distance between p1 and p2.

    GUIToWorld(Vector2, Vector3, Vector3)

    Transforms a GUI-space position into world space.

    Declaration
    public Vector3 GUIToWorld(Vector2 guiPosition, Vector3 planeNormal, Vector3 planePos)
    Parameters
    Type Name Description
    Vector2 guiPosition

    The GUI position

    Vector3 planeNormal

    The plane normal.

    Vector3 planePos

    The plane position.

    Returns
    Type Description
    Vector3

    Returns the world-space position of guiPosition.

    GetControlID(int, FocusType)

    Gets the ID of a nested control by a hint and focus type.

    Declaration
    public int GetControlID(int hint, FocusType focusType)
    Parameters
    Type Name Description
    int hint

    The hint this function uses to identify the control ID.

    FocusType focusType

    The focus Type

    Returns
    Type Description
    int

    Returns the ID of the control that matches the hint and focus type.

    GetHandleSize(Vector3)

    Gets the size of the handle.

    Declaration
    public float GetHandleSize(Vector3 position)
    Parameters
    Type Name Description
    Vector3 position

    The position of the handle.

    Returns
    Type Description
    float

    Returns the size of the handle.

    HasCurrentCamera()

    Checks if the current camera is valid.

    Declaration
    public bool HasCurrentCamera()
    Returns
    Type Description
    bool

    Returns true if the current camera is not null. Otherwise, returns false.

    Repaint()

    Repaints the GUI.

    Declaration
    public void Repaint()

    Slider(int, SliderData, out Vector3)

    Checks whether a slider value has changed.

    Declaration
    public bool Slider(int id, SliderData sliderData, out Vector3 newPosition)
    Parameters
    Type Name Description
    int id

    The ID of the slider to check.

    SliderData sliderData

    The slider's data.

    Vector3 newPosition

    The new position of the slider.

    Returns
    Type Description
    bool

    Returns true if the slider has changed. Otherwise, returns false.

    UseEvent()

    Uses the current event.

    Declaration
    public void UseEvent()

    Implements

    IGUIState
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)