docs.unity.cn
    Show / Hide Table of Contents

    Class ExpandedState<TState, TTarget>

    Used in editor drawer part to store the state of expandable areas using EditorPrefBoolFlags.

    Inheritance
    Object
    ExpandedStateBase<TState>
    ExpandedState<TState, TTarget>
    ExpandedStateList<TTarget>
    Inherited Members
    ExpandedStateBase<TState>.Item[TState]
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEditor.Rendering
    Syntax
    public class ExpandedState<TState, TTarget> : ExpandedStateBase<TState> 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, 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", string stateId = "UI_State")
    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)

    String stateId

    [Optional] Postfix used to differentiate between different keys (Default is UI_State)

    Fields

    m_State

    The variable which stores the state of expandable areas.

    Declaration
    protected EditorPrefBoolFlags<TState> m_State
    Field Value
    Type Description
    EditorPrefBoolFlags<TState>

    Methods

    CollapseAll()

    Utility to set all states to false

    Declaration
    public override void CollapseAll()
    Overrides
    UnityEditor.Rendering.ExpandedStateBase<TState>.CollapseAll()

    ExpandAll()

    Utility to set all states to true

    Declaration
    public override void ExpandAll()
    Overrides
    UnityEditor.Rendering.ExpandedStateBase<TState>.ExpandAll()

    GetExpandedAreas(TState)

    Accessor to the expended state of this specific mask.

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

    The filtering mask

    Returns
    Type Description
    Boolean

    True: All flagged area are expended

    Overrides
    UnityEditor.Rendering.ExpandedStateBase<TState>.GetExpandedAreas(TState)

    SetExpandedAreas(TState, Boolean)

    Setter to the expended state.

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

    The filtering mask

    Boolean value

    The expended state to set

    Overrides
    UnityEditor.Rendering.ExpandedStateBase<TState>.SetExpandedAreas(TState, System.Boolean)

    Extension Methods

    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, Boolean)
    ReflectionUtils.Invoke(Object, String, Object[])
    ReflectionUtils.SetField(Object, String, Object)
    ReflectionUtils.GetField(Object, String)
    ReflectionUtils.GetFields(Object)
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on 08 September 2023