Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

BlobArray<T0>.GetUnsafePtr

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public void* GetUnsafePtr();

Returns

void* An unsafe pointer.

Description

Provides an unsafe pointer to the array data.

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<T0> field itself instead of to the array data, and the BlobArray<T0>.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<T0>.GetUnsafePtr method of the BlobBuilderArray<T0> that BlobBuilder.Allocate returns.