Method RetrieveDisjointedPayloadBuffer
RetrieveDisjointedPayloadBuffer(PayloadHandle, int, out NativeArray<byte>)
Retrieves a NativeArray to safely access an individual Payload that's part of a Disjointed buffer.
Declaration
public bool RetrieveDisjointedPayloadBuffer(PayloadHandle handle, int payloadBufferIndex, out NativeArray<byte> payloadBuffer)
Parameters
Type | Name | Description |
---|---|---|
PayloadHandle | handle | A PayloadHandle value the references a valid Disjointed buffer." |
int | payloadBufferIndex | Index of the Payload, referenced by the Disjointed buffer, to retrieve. |
NativeArray<byte> | payloadBuffer | NativeArray that allows safe access to the allocated Payload buffer. |
Returns
Type | Description |
---|---|
bool | True if successfully accessed Payload buffer. |
Remarks
RetrieveDisjointedPayloadBuffer(PayloadHandle, int, bool, out NativeArray<byte>)
Retrieves a NativeArray to safely access an individual Payload that's part of a Disjointed buffer.
Declaration
public bool RetrieveDisjointedPayloadBuffer(PayloadHandle handle, int payloadBufferIndex, bool readWriteAccess, out NativeArray<byte> payloadBuffer)
Parameters
Type | Name | Description |
---|---|---|
PayloadHandle | handle | A PayloadHandle value the references a valid Disjointed buffer." |
int | payloadBufferIndex | Index of the Payload, referenced by the Disjointed buffer, to retrieve. |
bool | readWriteAccess | True to allow write-access to the returned NativeArray, otherwise it's read-only. |
NativeArray<byte> | payloadBuffer | NativeArray that allows safe access to the allocated Payload buffer. |
Returns
Type | Description |
---|---|
bool | True if successfully accessed Payload buffer. |
Remarks
See AllocateDisjointedBuffer(ref FixedList64Bytes<ushort>, NativeList<PayloadHandle>) for a general overview on "Disjointed" payload buffers.
Use this method to safely retrieve one of the Payload buffers, that's referenced by a Disjointed buffer, for reading or writing payload data, similar to RetrievePayloadBuffer(PayloadHandle, bool, out NativeArray<byte>).
The Payload buffer to retrieve is specified by an index of the PayloadHandle value within the head buffer. This index value corresponds to the list index used to create the Disjointed buffer. That is, the Payload size list passed into AllocateDisjointedBuffer(ref FixedList64Bytes<ushort>, NativeList<PayloadHandle>) or the PayloadHandle value list passed into CreateDisjointedPayloadBufferFromExistingPayloads(ref FixedList512Bytes<PayloadHandle>).
As with RetrievePayloadBuffer(PayloadHandle, bool, out NativeArray<byte>), the returned NativeArray is a "view" into the actual memory and must not be stored; it's only for immediate access to the underlying memory.