docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Control

    Represents a UI control in a custom editor.

    Inheritance
    object
    Control
    DefaultControl
    GenericControl
    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 abstract class Control

    Constructors

    Control(string)

    Initializes and returns an instance of Control

    Declaration
    public Control(string name)
    Parameters
    Type Name Description
    string name

    The name of the control

    Properties

    ID

    The control ID. The GUI uses this to identify the control.

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

    actionID

    The action ID.

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

    hotLayoutData

    The control's hot layout data

    Declaration
    public LayoutData hotLayoutData { get; }
    Property Value
    Type Description
    LayoutData

    layoutData

    The control's layout data. This contains information about the control's position and orientation.

    Declaration
    public LayoutData layoutData { get; set; }
    Property Value
    Type Description
    LayoutData

    name

    The name of the control.

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

    Methods

    BeginLayout(IGUIState)

    Begins the layout for this control. A call to EndLayout must always follow a call to this function.

    Declaration
    public void BeginLayout(IGUIState guiState)
    Parameters
    Type Name Description
    IGUIState guiState

    The current state of the custom editor.

    EndLayout(IGUIState)

    Ends the layout for this control. This function must always follow a call to BeginLayout().

    Declaration
    public void EndLayout(IGUIState guiState)
    Parameters
    Type Name Description
    IGUIState guiState

    The current state of the custom editor.

    GetControl(IGUIState)

    Gets the control from the guiState.

    Declaration
    public void GetControl(IGUIState guiState)
    Parameters
    Type Name Description
    IGUIState guiState

    The current state of the custom editor.

    GetCount()

    Gets the number of sub-controllers.

    Declaration
    protected virtual int GetCount()
    Returns
    Type Description
    int

    Returns the number of sub-controllers. If you do not override this function, this returns 1.

    Remarks

    By default, this is 1. If you implement your own controller and want to use multiple sub-controllers within it, you can override this function to declare how to count the sub-controllers.

    GetDistance(IGUIState, int)

    Gets the distance from the Scene view camera to the control.

    Declaration
    protected virtual float GetDistance(IGUIState guiState, int index)
    Parameters
    Type Name Description
    IGUIState guiState

    The current state of the custom editor.

    int index

    The index.

    Returns
    Type Description
    float

    Returns layoutData.distance.

    GetForward(IGUIState, int)

    Gets the forward vector of the control.

    Declaration
    protected virtual Vector3 GetForward(IGUIState guiState, int index)
    Parameters
    Type Name Description
    IGUIState guiState

    The current state of the custom editor.

    int index

    The index.

    Returns
    Type Description
    Vector3

    Returns Vector3.forward.

    GetPosition(IGUIState, int)

    Gets the position of the control.

    Declaration
    protected virtual Vector3 GetPosition(IGUIState guiState, int index)
    Parameters
    Type Name Description
    IGUIState guiState

    The current state of the custom editor.

    int index

    The index.

    Returns
    Type Description
    Vector3

    Returns Vector3.zero.

    GetRight(IGUIState, int)

    Gets the right vector of the control.

    Declaration
    protected virtual Vector3 GetRight(IGUIState guiState, int index)
    Parameters
    Type Name Description
    IGUIState guiState

    The current state of the custom editor.

    int index

    The index.

    Returns
    Type Description
    Vector3

    Returns Vector3.right.

    GetUp(IGUIState, int)

    Gets the up vector of the control.

    Declaration
    protected virtual Vector3 GetUp(IGUIState guiState, int index)
    Parameters
    Type Name Description
    IGUIState guiState

    The current state of the custom editor.

    int index

    The index.

    Returns
    Type Description
    Vector3

    Returns Vector3.up,

    GetUserData(IGUIState, int)

    Gets the control's user data.

    Declaration
    protected virtual object GetUserData(IGUIState guiState, int index)
    Parameters
    Type Name Description
    IGUIState guiState

    The current state of the custom editor.

    int index

    The index.

    Returns
    Type Description
    object

    Returns null.

    Layout(IGUIState)

    Gets the control's layout data from the guiState.

    Declaration
    public void Layout(IGUIState guiState)
    Parameters
    Type Name Description
    IGUIState guiState

    The current state of the custom editor.

    OnBeginLayout(LayoutData, IGUIState)

    Called when the control begins its layout.

    Declaration
    protected virtual LayoutData OnBeginLayout(LayoutData data, IGUIState guiState)
    Parameters
    Type Name Description
    LayoutData data

    The layout data.

    IGUIState guiState

    The current state of the custom editor.

    Returns
    Type Description
    LayoutData

    Returns the layout data to use.

    OnEndLayout(IGUIState)

    Called when the control ends its layout. ///

    Declaration
    protected virtual void OnEndLayout(IGUIState guiState)
    Parameters
    Type Name Description
    IGUIState guiState

    The current state of the custom editor.

    OnRepaint(IGUIState, int)

    Called when the control repaints its contents.

    Declaration
    protected virtual void OnRepaint(IGUIState guiState, int index)
    Parameters
    Type Name Description
    IGUIState guiState

    The current state of the custom editor.

    int index

    The index.

    Repaint(IGUIState)

    Repaints the control.

    Declaration
    public void Repaint(IGUIState guiState)
    Parameters
    Type Name Description
    IGUIState guiState

    The current state of the custom editor.

    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)