# GetEnabledRefRWOptional<T2>(Entity)

> Gets a safe reference to the component enabled state.

## Definition

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

## GetEnabledRefRWOptional\<T>(Entity)

```csharp
public EnabledRefRW<T2> GetEnabledRefRWOptional<T2>(Entity entity) where T2 : unmanaged, IBufferElementData, IEnableableComponent
```

### Parameters

**** (\[Entity]\(/engine/7000.0/script-reference/unity/entities/entity)): The referenced entity

### Returns

| Type                                                                                | Description                                                                                                                                                                                        |
| ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [EnabledRefRW\<T>](/engine/7000.0/script-reference/unity/entities/enabledrefrw1.md) | Returns a safe reference to the component enabled state. If the component doesn't exist, it returns a default [EnabledRefRW\<T>](/engine/7000.0/script-reference/unity/entities/enabledrefrw1.md). |
