---
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/animationstreammask/create
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/animationstreammask/create.md
last_updated: 2026-11-30
generated_at: 2026-11-30T21:13:00.788Z
locale: en-us
---

# Create

> Creates a read-write AnimationStreamMask from a RigDefinition and a NativeArray of WeightData.

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

Creates a read-write AnimationStreamMask from a RigDefinition and a NativeArray of WeightData.

```csharp
public static AnimationStreamMask Create(ref RigDefinition rig, NativeArray<WeightData> buffer)
```

### Parameters

**** (\[RigDefinition]\(/engine/7000.0/script-reference/unity/animations/rigdefinition)): The rig definition that describes the layout of the weight data.**** (\[NativeArray\<WeightData>]\(/engine/7000.0/script-reference/unity/collections/nativearray1)): The [NativeArray\<T>](/engine/7000.0/script-reference/unity/collections/nativearray1.md) of [WeightData](/engine/7000.0/script-reference/unity/animations/weightdata.md) that the mask views. Its length must be [BindingSet.StreamMaskSize](/engine/7000.0/script-reference/unity/animations/bindingset/streammasksize.md).

### Returns

| Type                                                                                           | Description                                                                                                                                                                                                                                                                                                                                                                                                   |
| ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AnimationStreamMask](/engine/7000.0/script-reference/unity/animations/animationstreammask.md) | A read-write [AnimationStreamMask](/engine/7000.0/script-reference/unity/animations/animationstreammask.md) that views `buffer`. Returns a default mask if `rig` is a null reference or `buffer` is empty. If safety checks are disabled, also returns a default mask if `buffer` is shorter than [BindingSet.StreamMaskSize](/engine/7000.0/script-reference/unity/animations/bindingset/streammasksize.md). |

## Create(RigDefinition, Allocator)

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

```csharp
public static AnimationStreamMask 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 weight 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 mask frees the buffer with the same allocator.

### Returns

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

### Remarks

The method clears the buffer, which holds [BindingSet.StreamMaskSize](/engine/7000.0/script-reference/unity/animations/bindingset/streammasksize.md) elements, so that every weight is 0. Call [AnimationStreamMask.Dispose](/engine/7000.0/script-reference/unity/animations/animationstreammask/dispose.md) to free the buffer, for example with a `using` statement. If safety checks are enabled, any copy of the mask throws an `ObjectDisposedException` when you use it after you dispose the mask.
