# SetComponentData

> Sets the value of a component of an entity.

## Definition

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

## SetComponentData\<T>(Entity, T)

Sets the value of a component of an entity.

```csharp
public void SetComponentData<T>(Entity entity, T componentData) where T : unmanaged, IComponentData
```

### Parameters

**** (\[Entity]\(/engine/7000.0/script-reference/unity/entities/entity)): The entity whose `T` component should be modified.**** (T): The value to assign to `entity`'s `T` component.

### Remarks

The target entity must exist, and it must have the target component.

## SetComponentData\<T>(SystemHandle, T)

Sets the value of a component of an entity associated with a system.

```csharp
public void SetComponentData<T>(SystemHandle system, T componentData) where T : unmanaged, IComponentData
```

### Parameters

**** (\[SystemHandle]\(/engine/7000.0/script-reference/unity/entities/systemhandle)): Handle to the system whose entity's `T` component should be modified.**** (T): The value to assign to the `T` component.

### Remarks

The target entity must exist, and it must have the target component.
