EventNamesAttribute.

EventNamesAttribute(Type) Constructor

Summary

Creates a new Animancer.EventNamesAttribute with Animancer.EventNamesAttribute.Names from the `type`.
Assembly
Animancer.dll
Namespace
Animancer
Containing Type
EventNamesAttribute

Syntax

public EventNamesAttribute(Type type)

Remarks

If the `type` is an enum, all of its values will be used.

Otherwise the values of all static string and Animancer.StringReference fields will be used.

Example:
public class AttackState
{
    public static readonly StringReference HitStart = "Hit Start";
    public static readonly StringReference HitEnd = "Hit End";

    [SerializeField]
    [EventNames(typeof(AttackState))]// Use all StringReference fields in this class.
    private ClipTransition _Animation;

    protected virtual void Awake()
    {
        _Animation.Events.SetCallback(HitStart, OnHitStart);
        _Animation.Events.SetCallback(HitEnd, OnHitEnd);
    }

    private void OnHitStart() { }
    private void OnHitEnd() { }
}

Parameters

Name Type Description
type Type

Return Value

Type Description
void