# TryGetSingleton<T>(out T)

> Gets the value of a singleton component, and returns whether or not a singleton component of the specified type exists in the World.

## Definition

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

## TryGetSingleton\<T>(T)

```csharp
public static bool TryGetSingleton<T>(out T value) where T : unmanaged, IComponentData
```

### Parameters

**** (T): The component. if an [Entity](/engine/7000.0/script-reference/unity/entities/entity.md) with the specified type does not exist in the [World](/engine/7000.0/script-reference/unity/entities/world.md), this is assigned a default value

### Returns

| Type                                                          | Description                                                                                                                                                                                              |
| ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if exactly one [Entity](/engine/7000.0/script-reference/unity/entities/entity.md) exists in the [World](/engine/7000.0/script-reference/unity/entities/world.md) with the provided component type. |

### Remarks

Not working in Entities.ForEach, IJobEntity, and Utility methods
