# HasSingleton<T>()

> Checks whether a singleton component of the specified type exists. Note that if querying a singleton component from a system-associated entity, the query must include either EntityQueryOptions.IncludeSystems or the SystemInstance component.

## Definition

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

```csharp
public bool HasSingleton<T>()
```

### Returns

| Type                                                          | Description                                                                                                                                              |
| ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if a singleton is found to match exactly once with the specified type[EntityQuery](/engine/7000.0/script-reference/unity/entities/entityquery.md). |

### Remarks

This method matches only the entities that this query matches, so the query's [EntityQueryOptions](/engine/7000.0/script-reference/unity/entities/entityqueryoptions.md) determine whether a singleton entity is found. Unless the query uses [EntityQueryOptions.IncludeDisabledEntities](/engine/7000.0/script-reference/unity/entities/entityqueryoptions/includedisabledentities.md) or [EntityQueryOptions.IncludePrefab](/engine/7000.0/script-reference/unity/entities/entityqueryoptions/includeprefab.md), entities that have the [Disabled](/engine/7000.0/script-reference/unity/entities/disabled.md) component or the [Prefab](/engine/7000.0/script-reference/unity/entities/prefab.md) component are excluded, and this method returns false for a singleton on one of those entities.
