Table of Contents

Class SerializedSwiftArray3D<T>

Unity-serializable adapter for persisted authoring data that is consumed as a SwiftArray3D<T>.

[Serializable]
public sealed class SerializedSwiftArray3D<T> : ISerializationCallbackReceiver

Type Parameters

T

A Unity-serializable item type.

Inheritance
SerializedSwiftArray3D<T>
Implements
ISerializationCallbackReceiver
Inherited Members

Properties

Depth

Gets the serialized depth.

public int Depth { get; }

Property Value

int

Height

Gets the serialized height.

public int Height { get; }

Property Value

int

this[int, int, int]

Gets or sets the item at the specified coordinates.

public T this[int x, int y, int z] { get; set; }

Parameters

x int

The zero-based horizontal coordinate.

y int

The zero-based vertical coordinate.

z int

The zero-based depth coordinate.

Property Value

T

The item at the specified coordinates.

Length

Gets the total serialized item count.

public int Length { get; }

Property Value

int

Runtime

Gets the live runtime 3D array rebuilt from Unity serialized data.

public SwiftArray3D<T> Runtime { get; }

Property Value

SwiftArray3D<T>

Remarks

Direct runtime mutations are copied into serialized backing data before Unity serialization.

Width

Gets the serialized width.

public int Width { get; }

Property Value

int

Methods

Clear()

Clears all serialized values without changing dimensions.

public void Clear()

OnAfterDeserialize()

Rebuilds runtime contents after Unity deserialization.

public void OnAfterDeserialize()

Exceptions

ArgumentOutOfRangeException

A serialized dimension is invalid.

ArgumentException

The serialized item count does not match the dimensions.

OnBeforeSerialize()

Copies live runtime contents into Unity's serialized backing data.

public void OnBeforeSerialize()

Resize(int, int, int)

Resizes the runtime array and updates the serialized backing data.

public void Resize(int width, int height, int depth)

Parameters

width int

The new width.

height int

The new height.

depth int

The new depth.

Exceptions

ArgumentOutOfRangeException

A dimension is negative or the resulting array is too large.

SetItems(int, int, int, params T[])

Replaces the serialized contents with the supplied dimensions and flat item data.

public void SetItems(int width, int height, int depth, params T[] items)

Parameters

width int

The array width.

height int

The array height.

depth int

The array depth.

items T[]

Flat item data in SwiftArray3D index order.

Exceptions

ArgumentNullException

items is null.

ArgumentOutOfRangeException

A dimension is negative or the resulting array is too large.

ArgumentException

The item count does not equal the product of the dimensions.

ToFlatArray()

Returns a copy of the flattened serialized data.

public T[] ToFlatArray()

Returns

T[]

A new flat array in SwiftArray3D index order.

ToSwiftArray3D()

Returns a copy as a standalone SwiftArray3D<T>.

public SwiftArray3D<T> ToSwiftArray3D()

Returns

SwiftArray3D<T>

A new 3D array containing the current values.