docs.unity.cn
    Show / Hide Table of Contents

    Struct ExpandedState<TState, TTarget>

    Used in editor drawer part to store the state of expendable areas.

    Namespace: UnityEditor.Rendering
    Syntax
    public struct ExpandedState<TState, TTarget>
        where TState : struct, IConvertible
    Type Parameters
    Name Description
    TState

    An enum to use to describe the state.

    TTarget

    A type given to automatically compute the key.

    Constructors

    ExpandedState(TState, String)

    Constructor will create the key to store in the EditorPref the state given generic type passed. The key will be formated as such prefix:TTarget:TState:UI_State.

    Declaration
    public ExpandedState(TState defaultValue, string prefix = "CoreRP")
    Parameters
    Type Name Description
    TState defaultValue

    If key did not exist, it will be created with this value for initialization.

    String prefix

    [Optional] Prefix scope of the key (Default is CoreRP)

    Properties

    Item[TState]

    Get or set the state given the mask.

    Declaration
    public bool this[TState mask] { get; set; }
    Parameters
    Type Name Description
    TState mask

    The filtering mask

    Property Value
    Type Description
    Boolean

    True: All flagged area are expended

    Methods

    CollapseAll()

    Utility to set all states to false

    Declaration
    public void CollapseAll()

    ExpandAll()

    Utility to set all states to true

    Declaration
    public void ExpandAll()

    GetExpandedAreas(TState)

    Accessor to the expended state of this specific mask.

    Declaration
    public bool GetExpandedAreas(TState mask)
    Parameters
    Type Name Description
    TState mask

    The filtering mask

    Returns
    Type Description
    Boolean

    True: All flagged area are expended

    SetExpandedAreas(TState, Boolean)

    Setter to the expended state.

    Declaration
    public void SetExpandedAreas(TState mask, bool value)
    Parameters
    Type Name Description
    TState mask

    The filtering mask

    Boolean value

    The expended state to set

    Extension Methods

    ReflectionUtils.Invoke(Object, String, Object[])
    ReflectionUtils.SetField(Object, String, Object)
    ReflectionUtils.GetField(Object, String)
    ReflectionUtils.GetFields(Object)
    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on 18 November 2022
    Terms of use