# AnimationEventInfo

> AnimationEventInfo is a read-only, non-allocating struct that provides information about an animation event when it fires.

## Definition

* **Type:** Struct
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.AnimationModule

```csharp
public ref struct AnimationEventInfo
```

## Remarks

AnimationEventInfo is a ref struct that serves as a read-only view of animation event data when an event is fired during animation playback. Unlike [AnimationEvent](/engine/6000.7/script-reference/unityengine/animationevent.md), AnimationEventInfo is designed for reporting event information in callbacks. It cannot be used for authoring or be stored in fields.

An animation event callback can accept either an AnimationEvent or an AnimationEventInfo parameter. Use AnimationEventInfo to avoid allocating the AnimationEvent object itself when an event fires.

The parameter can access floats, ints, strings, and object references configured on the animation event.

Note: The AnimationEventInfo struct itself doesn't allocate but accessing string properties ([\_functionName](/engine/6000.7/script-reference/unityengine/animationeventinfo/functionname.md) and [\_stringParameter](/engine/6000.7/script-reference/unityengine/animationeventinfo/stringparameter.md)) causes string allocation when retrieving from native code. Accessing non-string properties (such as `time`, `floatParameter`, `intParameter`, `objectReferenceParameter`, `isFiredByLegacy`, `isFiredByAnimator`, `animatorStateInfo`, and `animatorClipInfo`) causes no allocations.

A more detailed example shows how to access animator state information:

## Examples

```csharp
 // AnimationEventInfo example
 // Non-allocating event callback that reads event parameters

using UnityEngine;

public class Example : MonoBehaviour
{
    // This callback receives AnimationEventInfo instead of AnimationEvent
    // which avoids allocations when the event fires
    public void OnAnimationEvent(AnimationEventInfo eventInfo)
    {
        Debug.Log($"Event '{eventInfo.functionName}' fired at time {eventInfo.time}");
        Debug.Log($"Parameters: int={eventInfo.intParameter}, float={eventInfo.floatParameter}");
        Debug.Log($"String parameter: {eventInfo.stringParameter}");

        if (eventInfo.objectReferenceParameter != null)
        {
            Debug.Log($"Object reference: {eventInfo.objectReferenceParameter.name}");
        }
    }
}
```

```csharp
 // Accessing animator state information from AnimationEventInfo
using UnityEngine;

public class Example : MonoBehaviour
{
    public void OnAnimatorEvent(AnimationEventInfo eventInfo)
    {
        // Check the event source
        if (eventInfo.isFiredByAnimator)
        {
            // Access animator state information
            AnimatorStateInfo stateInfo = eventInfo.animatorStateInfo;
            Debug.Log($"State: {stateInfo.fullPathHash}, Time: {stateInfo.normalizedTime}");

            // Access clip information
            AnimatorClipInfo clipInfo = eventInfo.animatorClipInfo;
            if (clipInfo.clip != null)
            {
                Debug.Log($"Clip: {clipInfo.clip.name}, Weight: {clipInfo.weight}");
            }
        }
        else if (eventInfo.isFiredByLegacy)
        {
            // Access legacy animation state
            AnimationState animState = eventInfo.animationState;
            if (animState != null)
            {
                Debug.Log($"Animation: {animState.name}, Time: {animState.time}");
            }
        }
    }
}
```

## Properties

| Property                                                                                                               | Description                                                                           |
| ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| [animationState](/engine/6000.7/script-reference/unityengine/animationeventinfo/animationstate.md)                     | The animation state that fired this event (Read Only).                                |
| [animatorClipInfo](/engine/6000.7/script-reference/unityengine/animationeventinfo/animatorclipinfo.md)                 | The animator clip info related to this event (Read Only).                             |
| [animatorStateInfo](/engine/6000.7/script-reference/unityengine/animationeventinfo/animatorstateinfo.md)               | The animator state info related to this event (Read Only).                            |
| [floatParameter](/engine/6000.7/script-reference/unityengine/animationeventinfo/floatparameter.md)                     | Float parameter that is stored in the event (Read Only).                              |
| [functionName](/engine/6000.7/script-reference/unityengine/animationeventinfo/functionname.md)                         | The name of the called function (Read Only).                                          |
| [intParameter](/engine/6000.7/script-reference/unityengine/animationeventinfo/intparameter.md)                         | Integer parameter that is stored in the event (Read Only).                            |
| [isFiredByAnimator](/engine/6000.7/script-reference/unityengine/animationeventinfo/isfiredbyanimator.md)               | Returns true if this animation event was fired by an Animator component (Read Only).  |
| [isFiredByLegacy](/engine/6000.7/script-reference/unityengine/animationeventinfo/isfiredbylegacy.md)                   | Returns true if this animation event was fired by an Animation component (Read Only). |
| [objectReferenceParameter](/engine/6000.7/script-reference/unityengine/animationeventinfo/objectreferenceparameter.md) | Object reference parameter that is stored in the event (Read Only).                   |
| [stringParameter](/engine/6000.7/script-reference/unityengine/animationeventinfo/stringparameter.md)                   | String parameter that is stored in the event (Read Only).                             |
| [time](/engine/6000.7/script-reference/unityengine/animationeventinfo/time.md)                                         | The time at which the event is being fired (Read Only).                               |
