docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class OptionalEnumConverter<T>

    Base UXML attribute converter for OptionalEnum<T> values.

    Inheritance
    object
    UxmlAttributeConverter<OptionalEnum<T>>
    OptionalEnumConverter<T>
    OptionalDirConverter
    OptionalPopoverPlacementConverter
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.AppUI.Editor
    Assembly: Unity.AppUI.Editor.dll
    Syntax
    public abstract class OptionalEnumConverter<T> : UxmlAttributeConverter<OptionalEnum<T>> where T : struct, Enum
    Type Parameters
    Name Description
    T

    The enum type wrapped by the OptionalEnum<T>.

    Remarks

    An empty or unrecognized attribute value is converted to none.

    Methods

    FromString(string)

    Converts a UXML attribute value into an OptionalEnum<T>.

    Declaration
    public override OptionalEnum<T> FromString(string value)
    Parameters
    Type Name Description
    string value

    The attribute value to convert.

    Returns
    Type Description
    OptionalEnum<T>

    The converted value, or none if it is empty or not a member of T.

    Overrides
    UxmlAttributeConverter<OptionalEnum<T>>.FromString(string)

    ToString(OptionalEnum<T>)

    Converts an OptionalEnum<T> into its UXML attribute representation.

    Declaration
    public override string ToString(OptionalEnum<T> value)
    Parameters
    Type Name Description
    OptionalEnum<T> value

    The value to convert.

    Returns
    Type Description
    string

    The name of the enum member, or an empty string if no value is set.

    Overrides
    UnityEditor.UIElements.UxmlAttributeConverter<Unity.AppUI.Core.OptionalEnum<T>>.ToString(Unity.AppUI.Core.OptionalEnum<T>)
    In This Article
    Back to top
    Copyright © 2026 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)