# NextEntityIndexBatch(out int, out int)

> Iterates through the given ArchetypeChunk a whole contiguous run of available entities at a time, rather than one index at a time as ChunkEntityEnumerator.NextEntityIndex does. A run is a set of adjacent slots that are all available; batching lets a caller process a dense span in one operation. When every entity is available (the common case) this yields a single run [0, chunk.Count).

## Definition

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

## NextEntityIndexBatch(int, int)

```csharp
public bool NextEntityIndexBatch(out int startIndex, out int count)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The index of the first entity in the next available run, or -1 when the function returns false.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of consecutive available entities in the run.

### Returns

| Type                                                          | Description                            |
| ------------------------------------------------------------- | -------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Whether the iteration should continue. |
