# Build

> Create an EntityQuery owned by an ISystem 's SystemState.

## Definition

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

## Build(SystemState)

Create an EntityQuery owned by an [ISystem](/engine/7000.0/script-reference/unity/entities/isystem.md)'s [SystemState](/engine/7000.0/script-reference/unity/entities/systemstate.md).

```csharp
public EntityQuery Build(ref SystemState systemState)
```

### Parameters

**** (\[SystemState]\(/engine/7000.0/script-reference/unity/entities/systemstate)): SystemState of the system that will own the EntityQuery.

### Returns

| Type                                                                         | Description                                                           |
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| [EntityQuery](/engine/7000.0/script-reference/unity/entities/entityquery.md) | An EntityQuery based on the constraints set in the EntityQueryBuilder |

### Remarks

The System owning the systemState object retains this EntityQuery and disposes it at the end of the System's lifespan.

## Build(SystemBase)

Create an EntityQuery owned by an [SystemBase](/engine/7000.0/script-reference/unity/entities/systembase.md).

```csharp
[ExcludeFromBurstCompatTesting("SystemBase is a managed class")]
public EntityQuery Build(SystemBase systemBase)
```

### Parameters

**** (\[SystemBase]\(/engine/7000.0/script-reference/unity/entities/systembase)): System that will own the EntityQuery.

### Returns

| Type                                                                         | Description                                                           |
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| [EntityQuery](/engine/7000.0/script-reference/unity/entities/entityquery.md) | An EntityQuery based on the constraints set in the EntityQueryBuilder |

### Remarks

The SystemBase argument retains the EntityQuery, and disposes it at the end of that system's lifetime.

## Build(EntityManager)

Create an EntityQuery owned by an [EntityManager](/engine/7000.0/script-reference/unity/entities/entitymanager.md).

```csharp
public EntityQuery Build(EntityManager entityManager)
```

### Parameters

**** (\[EntityManager]\(/engine/7000.0/script-reference/unity/entities/entitymanager)): EntityManager that will own the EntityQuery.

### Returns

| Type                                                                         | Description                                                            |
| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| [EntityQuery](/engine/7000.0/script-reference/unity/entities/entityquery.md) | An EntityQuery based on the constraints set in the EntityQueryBuilder. |

### Remarks

The EntityManager retains the EntityQuery, and disposes it at the end of that EntityManager's corresponding World's lifetime.
