EventNamesAttribute Class

Summary

[Editor-Conditional] Specifies a set of acceptable names for Animancer.AnimancerEvents so they can display a warning in the Inspector if an unexpected name is used.
Assembly
Animancer.dll
Namespace
Animancer
Interfaces
Base Types
  • Attribute
graph BT Type-->Base0["Attribute"] Type-.->Interface0["IInitializable<MemberInfo>"] 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, IInitializable<MemberInfo>

Remarks

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

Documentation: Event Names

Example:
[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.

Attributes

Type Description
AttributeUsageAttribute
ConditionalAttribute

Constructors

Name Summary
EventNamesAttribute() Creates a new Animancer.EventNamesAttribute with Animancer.EventNamesAttribute.Names from the attributed type or declaring type of the attributed member.
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`.

Properties

Name Value Summary
HasNames bool
[Editor-Only] Has the Animancer.EventNamesAttribute.Names array been initialized?
Names StringReference[]
[Editor-Only] The names that can be used for events in the attributed field.

Methods

Name Value Summary
Initialize(MemberInfo) void
Initializes the Animancer.EventNamesAttribute.Names if they weren't already set in the constructor.
Initialize(Type) void
Initializes the Animancer.EventNamesAttribute.Names if they weren't already set in the constructor.
NamesToString(string, string) string
Returns a string containing all the Animancer.EventNamesAttribute.Names.