Documentation

Unity Engine

Download Unity

Unity Engine

Create

Creates a read-write AnimationStreamMask from a RigDefinition and a NativeArray of WeightData.
Read time 1 minuteLast updated 4 hours ago

Definition

Create(RigDefinition, NativeArray<WeightData>)

Creates a read-write AnimationStreamMask from a RigDefinition and a NativeArray of WeightData.
public static AnimationStreamMask Create(ref RigDefinition rig, NativeArray<WeightData> buffer)

Parameters

The rig definition that describes the layout of the weight data.

The NativeArray<T> of WeightData that the mask views. Its length must be BindingSet.StreamMaskSize.

Returns

Type

Description

AnimationStreamMaskA read-write AnimationStreamMask 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.

Create(RigDefinition, Allocator)

Creates a read-write AnimationStreamMask that allocates and owns its buffer.
public static AnimationStreamMask Create(ref RigDefinition rig, Allocator allocator)

Parameters

The rig definition that describes the layout of the weight data.

allocator

The Allocator to use to allocate the buffer. The mask frees the buffer with the same allocator.

Returns

Type

Description

AnimationStreamMaskA read-write AnimationStreamMask. Returns a default mask if
rig
is a null reference.

Remarks

The method clears the buffer, which holds BindingSet.StreamMaskSize elements, so that every weight is 0. Call AnimationStreamMask.Dispose 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.