# GetRefRWOptional(Entity)

> Obsolete. Use ComponentLookup<T>.TryGetRefRW instead. ///

## Definition

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

> **Warning:**
>
> **Deprecated.** This function should not be part of the public API, and will be removed in a future release.

```csharp
public RefRW<T> GetRefRWOptional(Entity entity)
```

### Parameters

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

### Returns

| Type                                                                  | Description                                                                                                      |
| --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| [RefRW\<T>](/engine/7000.0/script-reference/unity/entities/refrw1.md) | Returns a safe reference to the component data, or an invalid reference if `entity` does not have component `T`. |
