GetUnsafePtr()
Provides an unsafe pointer to the array data.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: Unity.Entities
- Assembly: UnityEngine.EntitiesModule
public void* GetUnsafePtr()
Returns
Type | Description |
|---|---|
| void* | An unsafe pointer. |
Remarks
You can only use unsafe pointers in [unsafe contexts]. [unsafe contexts]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/unsafe-code
Don't call this method before you call BlobBuilder.CreateBlobAssetReference. Unity assigns the array's internal offset at that point, so until then this method returns a pointer to the BlobArray<T> field itself instead of to the array data, and the BlobArray<T>.Length property returns 0. This method performs no validation and reports no error in this case.
To get a pointer to the array data before that point, use the BlobBuilderArray<T>.GetUnsafePtr method of the BlobBuilderArray<T> that BlobBuilder.Allocate returns.