---
title: CreateReadOnly(ref RigDefinition, NativeArray<AnimatedData>)
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/createreadonly
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/animationstream/createreadonly.md
last_updated: 2026-11-30
generated_at: 2026-11-30T21:03:18.456Z
locale: en-us
---

# CreateReadOnly(ref RigDefinition, NativeArray<AnimatedData>)

> Creates a read-only 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)

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

```csharp
public static AnimationStream CreateReadOnly(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-only [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.
