---
title: GatheredAnimationEvent
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/gatheredanimationevent
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/gatheredanimationevent.md
last_updated: 2026-11-30
generated_at: 2026-11-30T21:17:59.454Z
locale: en-us
---

# GatheredAnimationEvent

> An animation event that a clip timer crossed, with the function name, the parameters, and the time of the event.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Animations](/engine/7000.0/script-reference/unity/animations.md)
* **Assembly:** [UnityEngine.AnimationCoreModule](/engine/7000.0/script-reference/modules/unityengine-animationcoremodule.md)

```csharp
public struct GatheredAnimationEvent
```

## Remarks

Pass a `NativeList<GatheredAnimationEvent>` to [AnimationEventUtility.GatherAnimationEvents](/engine/7000.0/script-reference/unity/animations/animationeventutility/gatheranimationevents.md) to get the animation events that a timer crossed. The clip data stores the function name and the parameters of each event, so you can read them from jobs and Burst-compiled code. The function name and the string parameter are stored as [StringHash](/engine/7000.0/script-reference/unity/animations/stringhash.md) values. Compare them to `new StringHash("name")` values that you compute on the main thread. The object reference parameter is an `EntityId`. Use [GatheredAnimationEvent.EventIndex](/engine/7000.0/script-reference/unity/animations/gatheredanimationevent/eventindex.md) to read the complete event from the source animation clip on the main thread.

The following example uses the `System.Collections.Generic`, `Unity.Animations`, `Unity.Collections`, `Unity.Entities`, `Unity.IntegerTime`, and `UnityEngine` namespaces. It gathers the animation events that the playback time of a clip passes between two updates. It then uses the event index of each gathered event to read the function name of the event from the animation clip.

Additional Resources: [AnimationEventUtility](/engine/7000.0/script-reference/unity/animations/animationeventutility.md)

## Examples

```csharp
// This example reads the function name of each animation event that the clip time
// crosses between two updates.
public static List<string> GatherEventFunctionNames(
    AnimationClip animationClip, float previousTime, float currentTime)
{
    using BlobObjectReference<Clip> clipReference = animationClip.ToClipReference();
    // Stop if the animation clip is null or has no clip data.
    if (!clipReference.IsValid)
    {
        return new List<string>();
    }

    AnimationEvent[] clipEvents = animationClip.events;

    // Gather the events from previousTime (excluded) to currentTime (included), in seconds from the start of the clip.
    // To step over the end of a looping clip, pass a currentTime that is greater than the length of the clip.
    // When previousTime is greater than currentTime, the clip plays backward and the events come in descending order.
    using NativeList<GatheredAnimationEvent> gatheredEvents =
        new NativeList<GatheredAnimationEvent>(Allocator.Temp);
    AnimationEventUtility.GatherAnimationEvents(
        ref clipReference.Value, new DiscreteTime(previousTime), new DiscreteTime(currentTime), gatheredEvents);

    // The event index of each gathered event is its index in AnimationClip.events.
    List<string> functionNames = new List<string>();
    foreach (GatheredAnimationEvent gatheredEvent in gatheredEvents)
    {
        AnimationEvent clipEvent = clipEvents[gatheredEvent.EventIndex];
        functionNames.Add(clipEvent.functionName);
    }

    // For events at 0.25 and 0.75 seconds in a looping clip of 1 second, a range from 0.6 to 1.3 returns
    // the 0.75 event, then the 0.25 event of the next loop.
    return functionNames;
}
```

## Fields

| Value                                                                                                                           | Description                                                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [EventIndex](/engine/7000.0/script-reference/unity/animations/gatheredanimationevent/eventindex.md)                             | The index of the event in the events of the source animation clip.                                                                                                                  |
| [FloatParameter](/engine/7000.0/script-reference/unity/animations/gatheredanimationevent/floatparameter.md)                     | The float parameter value that the event stores.                                                                                                                                    |
| [FunctionName](/engine/7000.0/script-reference/unity/animations/gatheredanimationevent/functionname.md)                         | The hash of the name of the function of the event.                                                                                                                                  |
| [IntParameter](/engine/7000.0/script-reference/unity/animations/gatheredanimationevent/intparameter.md)                         | The int parameter value that the event stores.                                                                                                                                      |
| [Loop](/engine/7000.0/script-reference/unity/animations/gatheredanimationevent/loop.md)                                         | The loop count of the clip cycle in which the timer crossed the event, as a [TimerState.LoopCount](/engine/7000.0/script-reference/unity/animations/timerstate/loopcount.md) value. |
| [ObjectReferenceParameter](/engine/7000.0/script-reference/unity/animations/gatheredanimationevent/objectreferenceparameter.md) | The object reference parameter of the event, or `EntityId.None` if the event has none.                                                                                              |
| [StringParameter](/engine/7000.0/script-reference/unity/animations/gatheredanimationevent/stringparameter.md)                   | The hash of the string parameter of the event.                                                                                                                                      |
| [Time](/engine/7000.0/script-reference/unity/animations/gatheredanimationevent/time.md)                                         | The time of the event on the curves of the clip, in seconds.                                                                                                                        |
