---
title: Create
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/animationstream/create
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/animationstream/create.md
last_updated: 2026-11-30
generated_at: 2026-11-30T20:52:48.538Z
locale: en-us
---

# Create

> Creates a read-write AnimationStream from a RigDefinition and a NativeArray of AnimatedData.

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

## Create(RigDefinition, NativeArray\<AnimatedData>)

Creates a read-write AnimationStream from a RigDefinition and a NativeArray of AnimatedData.

```csharp
public static AnimationStream Create(ref RigDefinition rig, NativeArray<AnimatedData> buffer)
```

### Parameters

**** (\[RigDefinition]\(/engine/7000.0/script-reference/unity/animations/rigdefinition)): The rig definition that describes the layout of the animated data in `buffer`.**** (\[NativeArray\<AnimatedData>]\(/engine/7000.0/script-reference/unity/collections/nativearray1)): The [NativeArray\<T>](/engine/7000.0/script-reference/unity/collections/nativearray1.md) of [AnimatedData](/engine/7000.0/script-reference/unity/animations/animateddata.md) that the stream views. Its length must equal [BindingSet.StreamSize](/engine/7000.0/script-reference/unity/animations/bindingset/streamsize.md).

### Returns

| Type                                                                                   | Description                                                                                                                                                                                                            |
| -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AnimationStream](/engine/7000.0/script-reference/unity/animations/animationstream.md) | A read-write [AnimationStream](/engine/7000.0/script-reference/unity/animations/animationstream.md). Returns a default stream if `rig` is a null reference, or if `buffer` is empty and the rig has a nonempty stream. |

### Remarks

The stream is a view of `buffer` and uses its safety handle. If safety checks are enabled, using the stream after you dispose the array throws an `ObjectDisposedException`. Disposing the stream doesn't dispose the array.

## Create(RigDefinition, Allocator)

Creates a read-write AnimationStream that allocates and owns its buffer.

```csharp
public static AnimationStream Create(ref RigDefinition rig, Allocator allocator)
```

### Parameters

**** (\[RigDefinition]\(/engine/7000.0/script-reference/unity/animations/rigdefinition)): The rig definition that describes the layout of the animated data.**** (\[Allocator]\(/engine/7000.0/script-reference/unity/collections/allocator)): The [Allocator](/engine/7000.0/script-reference/unity/collections/allocator.md) to use to allocate the buffer. The stream frees the buffer with the same allocator.

### Returns

| Type                                                                                   | Description                                                                                                                                                 |
| -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AnimationStream](/engine/7000.0/script-reference/unity/animations/animationstream.md) | A read-write [AnimationStream](/engine/7000.0/script-reference/unity/animations/animationstream.md). Returns a default stream if `rig` is a null reference. |

### Remarks

The method fills the buffer, which holds [BindingSet.StreamSize](/engine/7000.0/script-reference/unity/animations/bindingset/streamsize.md) elements, with the default values of the rig, and clears the channel masks. Call [AnimationStream.Dispose](/engine/7000.0/script-reference/unity/animations/animationstream/dispose.md) to free the buffer, for example with a `using` statement. If safety checks are enabled, any copy of the stream throws an `ObjectDisposedException` when you use it after you dispose the stream.
