EventNamesAttribute Class

Summary

[Editor-Conditional] Specifies a set of acceptable names for Animancer.AnimancerEvents so they can be displayed using a dropdown menu instead of a text field.
Assembly
Animancer.dll
Namespace
Animancer
Base Types
  • Attribute
graph BT Type-->Base0["Attribute"] Type["EventNamesAttribute"] class Type type-node

Syntax

[AttributeUsage(AttributeTargets.Field | AttributeTargets.Class | AttributeTargets.Struct, Inherited = true)]
[System.Diagnostics.Conditional(Strings.UnityEditor)]
public sealed class EventNamesAttribute : Attribute

Examples

[EventNames(...)]// Apply to all fields in this class.
public class AttackState
{
    [SerializeField]
    [EventNames(...)]// Apply to only this field.
    private ClipTransition _Action;
}
See the constructors for examples of their usage.

Remarks

Placing this attribute on a type applies it to all fields in that type.

Note that values selected using the dropdown menu are still stored as strings. Modifying the names in the script will NOT automatically update any values previously set in the Inspector.

Documentation: Event Names

Attributes

Type Description
AttributeUsageAttribute
ConditionalAttribute

Constructors

Name Summary
EventNamesAttribute(string[]) Creates a new Animancer.EventNamesAttribute containing the specified `names`.
EventNamesAttribute(Type) Creates a new Animancer.EventNamesAttribute with Animancer.EventNamesAttribute.Names from the `type`.
EventNamesAttribute(Type, string) Creates a new Animancer.EventNamesAttribute with Animancer.EventNamesAttribute.Names from a member in the `type` with the specified `name`.

Fields

Name Constant Value Summary
Names
[Editor-Only] The names that can be used for events in the attributed field.
NoName
The entry used for the menu function to clear the name (U+202F Narrow No-Break Space).
static