Documentation

Unity Engine

Download Unity

Unity Engine

Create

Creates a read-write AnimationStream from a RigDefinition and a NativeArray of AnimatedData.
Read time 2 minutesLast updated 4 hours ago

Definition

Create(RigDefinition, NativeArray<AnimatedData>)

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

Parameters

The rig definition that describes the layout of the animated data in
buffer
.

The NativeArray<T> of AnimatedData that the stream views. Its length must equal BindingSet.StreamSize.

Returns

Type

Description

AnimationStreamA read-write AnimationStream. 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.
public static AnimationStream Create(ref RigDefinition rig, Allocator allocator)

Parameters

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

allocator

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

Returns

Type

Description

AnimationStreamA read-write AnimationStream. Returns a default stream if
rig
is a null reference.

Remarks

The method fills the buffer, which holds BindingSet.StreamSize elements, with the default values of the rig, and clears the channel masks. Call AnimationStream.Dispose 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.