# NextEntityIndex(out int)

> Iterates through the given ArchetypeChunk, retrieving the index of the next available entity as defined by the mask info provided to the constructor.

## Definition

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

## NextEntityIndex(int)

```csharp
public bool NextEntityIndex(out int nextIndex)
```

### Parameters

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

### Returns

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