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)

Examples

public class AttackState
{
    public static class Events
    {
        public const string HitStart = "Hit Start";
        public const string HitEnd = "Hit End";
    }

    [SerializeField]
    [EventNames(typeof(Events))]// Use all string fields in the Events class.
    private ClipTransition _Animation;

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

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

Remarks

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

Otherwise the values of all static string fields (including constants) will be used.

Parameters

Name Type Description
type Type

Return Value

Type Description
void