---
title: GatherAnimationEvents
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/animationeventutility/gatheranimationevents
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/animationeventutility/gatheranimationevents.md
last_updated: 2026-11-30
generated_at: 2026-11-30T23:02:32.596Z
locale: en-us
---

# GatherAnimationEvents

> Appends the animation events that a timer crossed during its last update to a list.

## Definition

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

## GatherAnimationEvents(Clip, TimerState, NativeList\<GatheredAnimationEvent>)

Appends the animation events that a timer crossed during its last update to a list.

```csharp
public static void GatherAnimationEvents(ref Clip clip, in TimerState timer, NativeList<GatheredAnimationEvent> events)
```

### Parameters

**** (\[Clip]\(/engine/7000.0/script-reference/unity/animations/clip)): The clip that holds the animation events to gather.**** (\[TimerState]\(/engine/7000.0/script-reference/unity/animations/timerstate)): The clip timer, updated for the frame. Its range must be inside the clip.**** (\[NativeList\<GatheredAnimationEvent>]\(/engine/7000.0/script-reference/unity/collections/nativelist1)): The list to append the gathered events to.

### Remarks

Use this method with a clip timer from [Clip.ToTimerState](/engine/7000.0/script-reference/unity/animations/clip/totimerstate.md), after you update the timer. The timer holds the time on the curves of the clip. The events therefore use the same time as the pose that [ClipSampler](/engine/7000.0/script-reference/unity/animations/clipsampler.md) samples from the timer, including the start time, the stop time, and the cycle offset of the clip.

The method gathers the events after [TimerState.PreviousTime](/engine/7000.0/script-reference/unity/animations/timerstate/previoustime.md), up to and including [TimerState.Time](/engine/7000.0/script-reference/unity/animations/timerstate/time.md). When the timer loops, the method gathers the events once for each cycle that the timer crossed. A frame that spans several loops therefore returns the events of every loop. A timer that has a negative [TimerState.TimeScale](/engine/7000.0/script-reference/unity/animations/timerstate/timescale.md) plays backward and returns the events in descending time order. When the wrap mode is [WrapMode.PingPong](/engine/7000.0/script-reference/unityengine/wrapmode/pingpong.md), the timer turns around at the ends of the range. It returns an event at an end once. The method doesn't gather events when the timer is paused or stopped, or when its delta time is 0.

The method includes the events at `TimerState.PreviousTime` in the following cases, so that an event at the start of the clip isn't missed:

* The update is the first update of a timer from `Clip.ToTimerState` with a time of 0.

* The timer was stopped during the previous update.

* The timer was rewound with [TimerStateExtensions.Rewind](/engine/7000.0/script-reference/unity/animations/timerstateextensions/rewind.md) or moved with [TimerStateExtensions.JumpToTime](/engine/7000.0/script-reference/unity/animations/timerstateextensions/jumptotime.md) since the previous update.

The method appends the events in playback order and doesn't clear the list first.

## GatherAnimationEvents(Clip, DiscreteTime, DiscreteTime, NativeList\<GatheredAnimationEvent>)

Appends the animation events that a clip crosses between two playback times to a list.

```csharp
public static void GatherAnimationEvents(ref Clip clip, DiscreteTime from, DiscreteTime to, NativeList<GatheredAnimationEvent> events)
```

### Parameters

**** (\[Clip]\(/engine/7000.0/script-reference/unity/animations/clip)): The clip that holds the animation events to gather.**** (\[DiscreteTime]\(/engine/7000.0/script-reference/unity/integertime/discretetime)): The start of the range, in seconds from the start of the clip.**** (\[DiscreteTime]\(/engine/7000.0/script-reference/unity/integertime/discretetime)): The end of the range, in seconds from the start of the clip.**** (\[NativeList\<GatheredAnimationEvent>]\(/engine/7000.0/script-reference/unity/collections/nativelist1)): The list to append the gathered events to.

### Remarks

Use this method when you track the playback time of the clip yourself. The times are playback times from the start of the clip, as in [ClipSampler.Sample](/engine/7000.0/script-reference/unity/animations/clipsampler/sample.md). The method creates a clip timer at `from`, advances it to `to`, and passes it to [AnimationEventUtility.GatherAnimationEvents](/engine/7000.0/script-reference/unity/animations/animationeventutility/gatheranimationevents.md), so the events are the ones that the sampled pose crosses.

When `from` is greater than `to`, the clip plays backward from `from` to `to`. To step forward over the end of a looping clip, pass a `to` that is greater than the length of the clip. The range can span any number of loops. The range excludes `from` and includes `to`, except that a `from` of 0 includes the events at the start of the clip.

## GatherAnimationEvents(BlobObjectReference\<Clip>, TimerState, NativeList\<GatheredAnimationEvent>)

Appends the animation events that a timer crossed during its last update to a list.

```csharp
public static void GatherAnimationEvents(BlobObjectReference<Clip> clip, in TimerState timer, NativeList<GatheredAnimationEvent> events)
```

### Parameters

**** (\[BlobObjectReference\<Clip>]\(/engine/7000.0/script-reference/unityengine/blobobjectreference1)): The reference to the clip that holds the animation events to gather. It must be valid.**** (\[TimerState]\(/engine/7000.0/script-reference/unity/animations/timerstate)): The clip timer, updated for the frame. Its range must be inside the clip.**** (\[NativeList\<GatheredAnimationEvent>]\(/engine/7000.0/script-reference/unity/collections/nativelist1)): The list to append the gathered events to.

### Remarks

This method behaves like [AnimationEventUtility.GatherAnimationEvents](/engine/7000.0/script-reference/unity/animations/animationeventutility/gatheranimationevents.md). Use it with the reference that [AnimationClipExtensions.ToClipReference](/engine/7000.0/script-reference/unity/animations/animationclipextensions/toclipreference.md) returns, or with [ClipSampler.Clip](/engine/7000.0/script-reference/unity/animations/clipsampler/clip.md), instead of passing its `Value`.

## GatherAnimationEvents(BlobObjectReference\<Clip>, DiscreteTime, DiscreteTime, NativeList\<GatheredAnimationEvent>)

Appends the animation events that a clip crosses between two playback times to a list.

```csharp
public static void GatherAnimationEvents(BlobObjectReference<Clip> clip, DiscreteTime from, DiscreteTime to, NativeList<GatheredAnimationEvent> events)
```

### Parameters

**** (\[BlobObjectReference\<Clip>]\(/engine/7000.0/script-reference/unityengine/blobobjectreference1)): The reference to the clip that holds the animation events to gather. It must be valid.**** (\[DiscreteTime]\(/engine/7000.0/script-reference/unity/integertime/discretetime)): The start of the range, in seconds from the start of the clip.**** (\[DiscreteTime]\(/engine/7000.0/script-reference/unity/integertime/discretetime)): The end of the range, in seconds from the start of the clip.**** (\[NativeList\<GatheredAnimationEvent>]\(/engine/7000.0/script-reference/unity/collections/nativelist1)): The list to append the gathered events to.

### Remarks

This method behaves like [AnimationEventUtility.GatherAnimationEvents](/engine/7000.0/script-reference/unity/animations/animationeventutility/gatheranimationevents.md). Use it with the reference that [AnimationClipExtensions.ToClipReference](/engine/7000.0/script-reference/unity/animations/animationclipextensions/toclipreference.md) returns, or with [ClipSampler.Clip](/engine/7000.0/script-reference/unity/animations/clipsampler/clip.md), instead of passing its `Value`.
