# GetUnsafePtr()

> Provides an unsafe pointer to the array data.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule

```csharp
public void* GetUnsafePtr()
```

### Returns

| Type                                                         | Description        |
| ------------------------------------------------------------ | ------------------ |
| [void\*](https://learn.microsoft.com/dotnet/api/system.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](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/unsafe-code)

Don't call this method before you call [BlobBuilder.CreateBlobAssetReference](/engine/7000.0/script-reference/unity/entities/blobbuilder/createblobassetreference.md). Unity assigns the array's internal offset at that point, so until then this method returns a pointer to the [BlobArray\<T>](/engine/7000.0/script-reference/unity/entities/blobarray1.md) field itself instead of to the array data, and the [BlobArray\<T>.Length](/engine/7000.0/script-reference/unity/entities/blobarray1/length.md) 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](/engine/7000.0/script-reference/unity/entities/blobbuilderarray1/getunsafeptr.md) method of the [BlobBuilderArray\<T>](/engine/7000.0/script-reference/unity/entities/blobbuilderarray1.md) that [BlobBuilder.Allocate](/engine/7000.0/script-reference/unity/entities/blobbuilder/allocate.md) returns.
