Struct NativeReference<T>
An unmanaged single value.
Implements
Namespace: Unity.Collections
Assembly: solution.dll
Syntax
[NativeContainer]
public struct NativeReference<T> : INativeDisposable where T : unmanaged
Type Parameters
Name | Description |
---|---|
T | The type of value. |
Remarks
The functional equivalent of an array of length 1. When you need just one value, NativeReference can be preferable to an array because it better conveys the intent.
Constructors
Name | Description |
---|---|
NativeReference(AllocatorHandle, NativeArrayOptions) | Initializes and returns an instance of NativeReference. |
NativeReference(T, AllocatorHandle) | Initializes and returns an instance of NativeReference. |
Properties
Name | Description |
---|---|
IsCreated | Whether this reference has been allocated (and not yet deallocated). |
Value | The value stored in this reference. |
Methods
Name | Description |
---|---|
AsReadOnly() | Returns a read-only reference aliasing the value of this reference. |
Copy(NativeReference<T>, NativeReference<T>) | Copies the value of a reference to another reference. |
CopyFrom(NativeReference<T>) | Copy the value of another reference to this reference. |
CopyTo(NativeReference<T>) | Copy the value of this reference to another reference. |
Dispose() | Releases all resources (memory and safety handles). |
Dispose(JobHandle) | Creates and schedules a job that will release all resources (memory and safety handles) of this reference. |
Equals(object) | Returns true if the value stored in this reference is equal to an object. |
Equals(NativeReference<T>) | Returns true if the value stored in this reference is equal to the value stored in another reference. |
GetHashCode() | Returns the hash code of this reference. |
Operators
Name | Description |
---|---|
operator ==(NativeReference<T>, NativeReference<T>) | Returns true if the values stored in two references are equal. |
implicit operator ReadOnly(NativeReference<T>) | Returns a read-only native reference that aliases the content of a native reference. |
operator !=(NativeReference<T>, NativeReference<T>) | Returns true if the values stored in two references are unequal. |