---
title: Dispose()
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/clipsampler/dispose
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/clipsampler/dispose.md
last_updated: 2026-11-30
generated_at: 2026-11-30T21:19:12.540Z
locale: en-us
---

# Dispose()

> Releases the clip reference and the memory of the sampler.

## 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)

```csharp
public void Dispose()
```

### Remarks

Copies of the sampler share the same memory. Call this method on only one copy, and don't use the other copies afterward. A sampler from [ClipSampler.Clone](/engine/7000.0/script-reference/unity/animations/clipsampler/clone.md) has its own memory, so this method doesn't affect it. This method has no effect on a default sampler.

If safety checks are enabled, a second call to this method throws an `ObjectDisposedException` on any copy. For a sampler that uses [Allocator.Temp](/engine/7000.0/script-reference/unity/collections/allocator/temp.md), the safety system doesn't detect that you use another copy after this call, as for other containers that use [Allocator.Temp](/engine/7000.0/script-reference/unity/collections/allocator/temp.md). The memory of the sampler stays valid until the end of the scope of the temporary allocations, but the clip data can be released. Using the copy on which you called `Dispose` throws a `NullReferenceException`.
