Table of Contents

Class TypeSelectorAttribute

Namespace
Homa.Sdk.Foundation
Assembly
Homa.Sdk.Foundation.dll

Attribute used to make a string field in a script be restricted to C# type name.

When this attribute is used, the string be shown as a dropdown button in the Inspector instead of the default string field.

String value represents the type name qualified by its namespace (e.g. "UnityEngine.Object").

[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field)]
public class TypeSelectorAttribute : PropertyAttribute
Inheritance
PropertyAttribute
TypeSelectorAttribute
Inherited Members
PropertyAttribute.order

Constructors

TypeSelectorAttribute(Type)

public TypeSelectorAttribute(Type baseType)

Parameters

baseType Type

Determines the list of valid values for the field. Valid values are the types that implement or derive from this type.

Properties

AllowEmpty

Should the field be allowed to be empty.

public bool AllowEmpty { get; set; }

Property Value

bool

BaseType

Determines the list of valid values for the field. Valid values are the types that implement or derive from this type.

public Type BaseType { get; set; }

Property Value

Type

Filters

Filters to apply when retrieving valid types.

public TypeFilters Filters { get; set; }

Property Value

TypeFilters

IncludeBaseType

Should the base type be included in the list of valid values.

[Obsolete("Use 'Filters' instead.")]
public bool IncludeBaseType { get; set; }

Property Value

bool

Methods

GetValidTypes()

Retrieves a collection of valid types based on the attribute settings.

public IEnumerable<Type> GetValidTypes()

Returns

IEnumerable<Type>