Struct NativeArray2D<T>
A 2-dimension Unity.Collections.NativeArray<T> backed array.
Implements
Namespace: GDX.Collections.Generic
Syntax
public struct NativeArray2D<T> : IDisposable where T : struct
Type Parameters
Name | Description |
---|---|
T | Type of objects. |
Remarks
Use X (horizontal) and Y (vertical) arrangement.
Constructors
| Improve this Doc View SourceNativeArray2D(Int32, Int32, Allocator, NativeArrayOptions)
Create a NativeArray2D<T>.
Declaration
public NativeArray2D(int rowCount, int columnCount, Allocator allocator, NativeArrayOptions nativeArrayOptions)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowCount | The number of rows (X). |
System.Int32 | columnCount | The number of columns (Y). |
Unity.Collections.Allocator | allocator | The Unity.Collections.Allocator type to use. |
Unity.Collections.NativeArrayOptions | nativeArrayOptions | Should the memory be cleared on allocation? |
Fields
| Improve this Doc View SourceArray
The backing Unity.Collections.NativeArray<T>.
Declaration
public NativeArray<T> Array
Field Value
Type | Description |
---|---|
Unity.Collections.NativeArray<T> |
ColumnCount
The length of each pseudo-array in the dataset.
Declaration
public int ColumnCount
Field Value
Type | Description |
---|---|
System.Int32 |
Remarks
CAUTION! Changing this will alter the understanding of the data.
RowCount
The number of pseudo-arrays created to support the dimensionality.
Declaration
public int RowCount
Field Value
Type | Description |
---|---|
System.Int32 |
Remarks
CAUTION! Changing this will alter the understanding of the data.
Properties
| Improve this Doc View SourceItem[Int32, Int32]
Get a typed object at a specific 2-dimensional index in Array.
Declaration
public T this[int x, int y] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | The row/line number (vertical axis). |
System.Int32 | y | The column number (horizontal axis). |
Property Value
Type | Description |
---|---|
T |
Methods
| Improve this Doc View SourceAddColumns(Int32, Allocator, NativeArrayOptions)
Add additional columns to the dataset.
Declaration
public void AddColumns(int numberOfNewColumns, Allocator allocator, NativeArrayOptions nativeArrayOptions)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberOfNewColumns | The number of columns add. |
Unity.Collections.Allocator | allocator | The Unity.Collections.Allocator type to use. |
Unity.Collections.NativeArrayOptions | nativeArrayOptions | Should the memory be cleared on allocation? |
AddRows(Int32, Allocator, NativeArrayOptions)
Add additional rows to the dataset.
Declaration
public void AddRows(int numberOfNewRows, Allocator allocator, NativeArrayOptions nativeArrayOptions)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberOfNewRows | The number of rows/arrays to add. |
Unity.Collections.Allocator | allocator | The Unity.Collections.Allocator type to use. |
Unity.Collections.NativeArrayOptions | nativeArrayOptions | Should the memory be cleared on allocation? |
Dispose()
Properly dispose of Array.
Declaration
public void Dispose()
ReverseColumns()
Reverse the order of the columns in the backing Array.
Declaration
public void ReverseColumns()
ReverseRows()
Reverse the order of the rows in the backing Array.
Declaration
public void ReverseRows()
ToMultiDimensionalArray()
Creates a copy of the internal array as a traditional multi-dimensional array.
Declaration
public T[, ] ToMultiDimensionalArray()
Returns
Type | Description |
---|---|
T[,] | A new copy of the backing Array in multi-dimensional form. |
Remarks
Useful for scenarios where fills need to be done with [,] structured multi-dimensional arrays.