Fusion type for networking arrays. Maximum capacity is fixed, and is set with the CapacityAttribute.
More...
Inherits IEnumerable< T >.
Public Member Functions | |
void | CopyFrom (List< T > source, int sourceOffset, int sourceCount) |
Copies a range of values in from a supplied source list. More... | |
void | CopyFrom (T[] source, int sourceOffset, int sourceCount) |
Copies a range of values in from a supplied source array. More... | |
void | CopyTo (List< T > list) |
Adds each value to the supplied List. This does not clear the list, so values will be appended to the existing list. More... | |
void | CopyTo (T[] array, bool throwIfOverflow=true) |
Copies values to the supplied array. More... | |
T | Get (int index) |
Returns the array value at supplied index. More... | |
Enumerator | GetEnumerator () |
IEnumerator< T > IEnumerable< T >. | GetEnumerator () |
IEnumerator IEnumerable. | GetEnumerator () |
NetworkArray (byte *array, int length, IElementReaderWriter< T > readerWriter) | |
NetworkArray constructor. More... | |
NetworkArray< T > | Remap (void *array) |
T | Set (int index, T value) |
Sets the array value at the supplied index. More... | |
T[] | ToArray () |
Allocates a new array and copies values from this array. For a non-alloc alternative use CopyTo(List<T>). More... | |
string | ToListString () |
Returns the elements of this array as a string, with value separated by characters. Specifically for use in the Unity inspector. This is private and only is found by NetworkBehaviourEditor using reflection, so do not rename this method. More... | |
override string | ToString () |
Public Attributes | |
byte * | _array |
int | _length |
IElementReaderWriter< T > | _readerWriter |
Static Public Attributes | |
static StringBuilder | _stringBuilderCached |
Properties | |
int | Length [get] |
The fixed size of the array. More... | |
T | this[int index] [get, set] |
Indexer of array elements. More... | |
Fusion type for networking arrays. Maximum capacity is fixed, and is set with the CapacityAttribute.
Typical Usage: [Networked, Capacity(4)]
NetworkArray<float> syncedArray => default;
Optional usage (for NetworkBehaviours ONLY - this is not legal in INetworkStructs): [Networked, Capacity(4)]
NetworkArray<int> syncedArray { get; } = MakeInitializer(new int[] { 1, 2, 3, 4 });
Usage for modifying data: array.Set(123); array[0] = 456;
T | T can be a primitive, or an INetworkStruct. |
NetworkArray | ( | byte * | array, |
int | length, | ||
IElementReaderWriter< T > | readerWriter | ||
) |
NetworkArray constructor.
void CopyFrom | ( | List< T > | source, |
int | sourceOffset, | ||
int | sourceCount | ||
) |
Copies a range of values in from a supplied source list.
sourceOffset | Starting index of elements in source. |
sourceCount | Number of sequential source elements to copy in. |
void CopyFrom | ( | T[] | source, |
int | sourceOffset, | ||
int | sourceCount | ||
) |
Copies a range of values in from a supplied source array.
sourceOffset | Starting index of elements in source. |
sourceCount | Number of sequential source elements to copy in. |
void CopyTo | ( | List< T > | list | ) |
Adds each value to the supplied List. This does not clear the list, so values will be appended to the existing list.
void CopyTo | ( | T[] | array, |
bool | throwIfOverflow = true |
||
) |
Copies values to the supplied array.
array | |
throwIfOverflow | If true, this method will throw an error if the supplied array is smaller than this NetworkArray<T>. If false, will only copy as many elements as the target array can hold. |
T Get | ( | int | index | ) |
Returns the array value at supplied index.
T Set | ( | int | index, |
T | value | ||
) |
Sets the array value at the supplied index.
T [] ToArray | ( | ) |
Allocates a new array and copies values from this array. For a non-alloc alternative use CopyTo(List<T>).
string ToListString | ( | ) |
Returns the elements of this array as a string, with value separated by
characters. Specifically for use in the Unity inspector. This is private and only is found by NetworkBehaviourEditor using reflection, so do not rename this method.
|
get |
The fixed size of the array.
|
getset |
Indexer of array elements.