# GetRefRW

> Gets a safe reference to the component data.

## Definition

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

## GetRefRW(SystemHandle)

Gets a safe reference to the component data.

```csharp
public RefRW<T> GetRefRW(SystemHandle system)
```

### Parameters

**** (\[SystemHandle]\(/engine/7000.0/script-reference/unity/entities/systemhandle)): The system handle with 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. Throws an exception if the component doesn't exist. |

## GetRefRW(Entity)

Gets a safe reference to the component data.

```csharp
public RefRW<T> GetRefRW(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. Throws an exception if the component doesn't exist. |
