Class SerializedSwiftArray3D<T>
- Namespace
- SwiftCollections.Unity
Unity-serializable adapter for persisted authoring data that is consumed as a SwiftArray3D<T>.
[Serializable]
public sealed class SerializedSwiftArray3D<T> : ISerializationCallbackReceiver
Type Parameters
TA Unity-serializable item type.
- Inheritance
-
SerializedSwiftArray3D<T>
- Implements
-
ISerializationCallbackReceiver
- Inherited Members
Properties
Depth
Gets the serialized depth.
public int Depth { get; }
Property Value
Height
Gets the serialized height.
public int Height { get; }
Property Value
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
xintThe zero-based horizontal coordinate.
yintThe zero-based vertical coordinate.
zintThe 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
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
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
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
widthintThe array width.
heightintThe array height.
depthintThe array depth.
itemsT[]Flat item data in SwiftArray3D index order.
Exceptions
- ArgumentNullException
itemsis 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.