Summary
Creates a new
Animancer.EventNamesAttribute
with Animancer.EventNamesAttribute.Names
from a member in the `type`
with the specified `name`.
- Assembly
- Animancer
.dll - Namespace
- Animancer
- Containing Type
- EventNamesAttribute
Syntax
public EventNamesAttribute(Type type, string name)
Remarks
The specified member must be static and can be a Field, Property, or Method.
The member type can be anything implementing
System.Collections.IEnumerable
(including arrays, lists, and
coroutines).
Example:public class AttackState
{
public static readonly StringReference[] Events = { "Hit Start", "Hit End" };
[SerializeField]
[EventNames(typeof(AttackState), nameof(Events))]// Get the names from AttackState.Events.
private ClipTransition _Animation;
protected virtual void Awake()
{
_Animation.Events.SetCallback(Events[0], OnHitStart);
_Animation.Events.SetCallback(Events[1], OnHitEnd);
}
private void OnHitStart() { }
private void OnHitEnd() { }
}
Parameters
Name | Type | Description |
---|---|---|
type | Type | |
name | string |
Return Value
Type | Description |
---|---|
void |