Class Extensions
Static class that contains various extension methods.
Namespace: Unity.Kinematica
Syntax
public static class Extensions
Methods
At<T>(NativeArray<T>, Int32)
Retrieves a reference to an element of a native array.
Declaration
public static T At<T>(this NativeArray<T> nativeArray, int index)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
NativeArray<T> | nativeArray | |
Int32 | index | Index of the native array element. |
Returns
Type | Description |
---|---|
T | Reference to the element at the index passed as argument. |
Type Parameters
Name | Description |
---|---|
T |
At<T>(NativeList<T>, Int32)
Retrieves a reference to an element of a native list.
Declaration
public static T At<T>(this NativeList<T> nativeList, int index)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
NativeList<T> | nativeList | |
Int32 | index | Index of the native list element. |
Returns
Type | Description |
---|---|
T | Reference to the element at the index passed as argument. |
Type Parameters
Name | Description |
---|---|
T |
At<T>(NativeSlice<T>, Int32)
Retrieves a reference to an element of a native slice.
Declaration
public static T At<T>(this NativeSlice<T> nativeSlice, int index)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
NativeSlice<T> | nativeSlice | |
Int32 | index | Index of the native slice element. |
Returns
Type | Description |
---|---|
T | Reference to the element at the index passed as argument. |
Type Parameters
Name | Description |
---|---|
T |
ReadAffineTransform(BinaryReader)
Reads a transform from the binary reader.
Declaration
public static AffineTransform ReadAffineTransform(this BinaryReader reader)
Parameters
Type | Name | Description |
---|---|---|
BinaryReader | reader |
Returns
Type | Description |
---|---|
AffineTransform | The transform that has been read. |
ReadComponent<T>(BinaryReader)
Reads a component from the binary reader.
Declaration
public static T ReadComponent<T>(this BinaryReader reader)
where T : Component
Parameters
Type | Name | Description |
---|---|---|
BinaryReader | reader |
Returns
Type | Description |
---|---|
T | The component that has been read. |
Type Parameters
Name | Description |
---|---|
T |
ReadFromStream<T>(NativeList<T>, BinaryReader)
Reads a native list from the binary reader.
Declaration
public static void ReadFromStream<T>(this NativeList<T> nativeList, BinaryReader reader)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
NativeList<T> | nativeList | |
BinaryReader | reader |
Type Parameters
Name | Description |
---|---|
T |
ReadQuaternion(BinaryReader)
Reads a quaternion from the binary reader.
Declaration
public static Quaternion ReadQuaternion(this BinaryReader reader)
Parameters
Type | Name | Description |
---|---|---|
BinaryReader | reader |
Returns
Type | Description |
---|---|
Quaternion | The quaternion that has been read. |
ReadTransform(BinaryReader)
Reads a transform from the binary reader.
Declaration
public static Transform ReadTransform(this BinaryReader reader)
Parameters
Type | Name | Description |
---|---|---|
BinaryReader | reader |
Returns
Type | Description |
---|---|
Transform | The transform that has been read. |
ReadVector3(BinaryReader)
Reads a vector3 from the binary reader.
Declaration
public static Vector3 ReadVector3(this BinaryReader reader)
Parameters
Type | Name | Description |
---|---|---|
BinaryReader | reader |
Returns
Type | Description |
---|---|
Vector3 | The vector that has been read. |
Write(BinaryWriter, Quaternion)
Writes a quaternion to the binary writer.
Declaration
public static void Write(this BinaryWriter writer, Quaternion value)
Parameters
Type | Name | Description |
---|---|---|
BinaryWriter | writer | |
Quaternion | value | The quaternion that should be written. |
Write(BinaryWriter, AffineTransform)
Writes a transform to the binary writer.
Declaration
public static void Write(this BinaryWriter writer, AffineTransform transform)
Parameters
Type | Name | Description |
---|---|---|
BinaryWriter | writer | |
AffineTransform | transform | The transform that should be written. |
Write(BinaryWriter, Vector3)
Writes a vector3 to the binary writer.
Declaration
public static void Write(this BinaryWriter writer, Vector3 value)
Parameters
Type | Name | Description |
---|---|---|
BinaryWriter | writer | |
Vector3 | value | The vector3 that should be written. |
WriteComponent<T>(BinaryWriter, T)
Writes a component path to the binary writer.
Declaration
public static void WriteComponent<T>(this BinaryWriter writer, T component)
where T : Component
Parameters
Type | Name | Description |
---|---|---|
BinaryWriter | writer | |
T | component | The component that should be written. |
Type Parameters
Name | Description |
---|---|
T |
WriteToStream<T>(NativeList<T>, BinaryWriter)
Writes a native list to the binary writer.
Declaration
public static void WriteToStream<T>(this NativeList<T> nativeList, BinaryWriter writer)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
NativeList<T> | nativeList | |
BinaryWriter | writer |
Type Parameters
Name | Description |
---|---|
T |
WriteTransform(BinaryWriter, Transform)
Writes a transform to the binary writer.
Declaration
public static void WriteTransform(this BinaryWriter writer, Transform transform)
Parameters
Type | Name | Description |
---|---|---|
BinaryWriter | writer | |
Transform | transform | The transform that should be written. |