docs.unity.cn
    Show / Hide Table of Contents

    Class GUIState

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

    Inheritance
    Object
    GUIState
    Namespace: UnityEditor.U2D.Path.GUIFramework
    Syntax
    public class GUIState : object, IGUIState

    Properties

    changed

    Indicates whether the GUI has changed.

    Declaration
    public bool changed { get; set; }
    Property Value
    Type Description
    Boolean
    Implements
    IGUIState.changed

    clickCount

    The current number of mouse clicks.

    Declaration
    public int clickCount { get; set; }
    Property Value
    Type Description
    Int32
    Implements
    IGUIState.clickCount

    commandName

    The name of the current event's command.

    Declaration
    public string commandName { get; }
    Property Value
    Type Description
    String
    Implements
    IGUIState.commandName

    eventType

    The type of the current event.

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

    hotControl

    Hot Control

    Declaration
    public int hotControl { get; set; }
    Property Value
    Type Description
    Int32
    Implements
    IGUIState.hotControl

    isActionKeyDown

    Indicates whether the action key is pressed.

    Declaration
    public bool isActionKeyDown { get; }
    Property Value
    Type Description
    Boolean
    Implements
    IGUIState.isActionKeyDown

    isAltDown

    Indicates whether the alt key is pressed.

    Declaration
    public bool isAltDown { get; }
    Property Value
    Type Description
    Boolean
    Implements
    IGUIState.isAltDown

    isShiftDown

    Indicates whether the shift key is pressed.

    Declaration
    public bool isShiftDown { get; }
    Property Value
    Type Description
    Boolean
    Implements
    IGUIState.isShiftDown

    keyCode

    The KeyCode of the currently pressed key.

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

    mouseButton

    The currently pressed button.

    Declaration
    public int mouseButton { get; }
    Property Value
    Type Description
    Int32
    Implements
    IGUIState.mouseButton

    mousePosition

    The current mouse position.

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

    nearestControl

    The closest control to the event.

    Declaration
    public int nearestControl { get; set; }
    Property Value
    Type Description
    Int32
    Implements
    IGUIState.nearestControl

    Methods

    AddControl(Int32, Single)

    Adds a control to the GUIState.

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

    The ID of the control to add.

    Single distance

    The distance from the camera to the control.

    Implements
    IGUIState.AddControl(Int32, Single)

    DistanceToCircle(Vector3, Single)

    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.

    Single radius

    The radius of the circle.

    Returns
    Type Description
    Single

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

    Implements
    IGUIState.DistanceToCircle(Vector3, Single)

    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
    Single

    Returns the GUI-space distance between p1 and p2.

    Implements
    IGUIState.DistanceToSegment(Vector3, Vector3)

    GetControlID(Int32, 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
    Int32 hint

    The hint this function uses to identify the control ID.

    FocusType focusType

    The focus Type

    Returns
    Type Description
    Int32

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

    Implements
    IGUIState.GetControlID(Int32, FocusType)

    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
    Single

    Returns the size of the handle.

    Implements
    IGUIState.GetHandleSize(Vector3)

    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.

    Implements
    IGUIState.GUIToWorld(Vector2, Vector3, Vector3)

    HasCurrentCamera()

    Checks if the current camera is valid.

    Declaration
    public bool HasCurrentCamera()
    Returns
    Type Description
    Boolean

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

    Implements
    IGUIState.HasCurrentCamera()

    Repaint()

    Repaints the GUI.

    Declaration
    public void Repaint()
    Implements
    IGUIState.Repaint()

    Slider(Int32, 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
    Int32 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
    Boolean

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

    Implements
    IGUIState.Slider(Int32, SliderData, out Vector3)

    UseEvent()

    Uses the current event.

    Declaration
    public void UseEvent()
    Implements
    IGUIState.UseEvent()
    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on Tuesday, March 1, 2022
    Terms of use