# GetScratchpadAllocator

> Retrieve the ScratchpadAllocator from the Scratchpad with index corresponding to the running thread index.

## Definition

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

## GetScratchpadAllocator()

Retrieve the ScratchpadAllocator from the Scratchpad with index corresponding to the running thread index.

```csharp
public ref ScratchpadAllocator GetScratchpadAllocator()
```

### Returns

| Type                                                                                         | Description                                                          |
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| [ScratchpadAllocator](/engine/7000.0/script-reference/unity/entities/scratchpadallocator.md) | Returns reference to the ScratchpadAllocator for the running thread. |

## GetScratchpadAllocator(int)

Retrieve the ScratchpadAllocator from the Scratchpad with index corresponding to the running thread index.

```csharp
public ref ScratchpadAllocator GetScratchpadAllocator(int threadIndex)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Index of the running thread.

### Returns

| Type                                                                                         | Description                                                          |
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| [ScratchpadAllocator](/engine/7000.0/script-reference/unity/entities/scratchpadallocator.md) | Returns reference to the ScratchpadAllocator for the running thread. |
