# TryGetSingletonRW<T>(out RefRW<T>)

> Gets a reference to the value of a singleton component, and returns whether or not a singleton component of the specified type matches inside the EntityQuery. 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

## TryGetSingletonRW\<T>(RefRW\<T>)

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

### Parameters

**** (\[RefRW\<T>]\(/engine/7000.0/script-reference/unity/entities/refrw1)): The reference of the component

### Returns

| Type                                                          | Description                             |
| ------------------------------------------------------------- | --------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | A reference to the singleton component. |

### Remarks

A singleton component is a component of which only one instance exists that satisfies this query.

Additional Resources: [EntityQuery.GetSingletonRW](/engine/7000.0/script-reference/unity/entities/entityquery/getsingletonrw.md), [EntityQuery.SetSingleton](/engine/7000.0/script-reference/unity/entities/entityquery/setsingleton.md), [EntityQuery.GetSingletonEntity](/engine/7000.0/script-reference/unity/entities/entityquery/getsingletonentity.md), [EntityQuery.GetSingletonBuffer](/engine/7000.0/script-reference/unity/entities/entityquery/getsingletonbuffer.md), [ComponentSystemBase.GetSingleton](/engine/7000.0/script-reference/unity/entities/componentsystembase/getsingleton.md)
