---
title: AddComponentData<T>(Entity, T)
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/entities/globalentitymanager/addcomponentdata
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/entities/globalentitymanager/addcomponentdata.md
last_updated: 2026-11-03
generated_at: 2026-11-04T05:57:33.296Z
locale: en-us
---

# AddComponentData<T>(Entity, T)

> Adds a component to an entity and sets its value.

## Definition

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

```csharp
public static bool AddComponentData<T>(Entity entity, T componentData) where T : unmanaged, IComponentData
```

### Parameters

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

### Returns

| Type                                                          | Description                                                                         |
| ------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | False if the entity already had the component, in which case only its value is set. |

### Remarks

This is a structural change.
