---
title: AddComponent
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/addcomponent
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/entities/globalentitymanager/addcomponent.md
last_updated: 2026-11-03
generated_at: 2026-11-04T11:39:17.860Z
locale: en-us
---

# AddComponent

> Adds a component to an entity.

## Definition

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

## AddComponent\<T>(Entity)

Adds a component to an entity.

```csharp
public static bool AddComponent<T>(Entity entity)
```

### Parameters

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

### Returns

| Type                                                          | Description                                    |
| ------------------------------------------------------------- | ---------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | False if the entity already had the component. |

### Remarks

This is a structural change.

## AddComponent(Entity, ComponentType)

Adds a component to an entity.

```csharp
public static bool AddComponent(Entity entity, ComponentType componentType)
```

### Parameters

**** (\[Entity]\(/engine/7000.0/script-reference/unity/entities/entity)): The entity.**** (\[ComponentType]\(/engine/7000.0/script-reference/unity/entities/componenttype)): The component type.

### Returns

| Type                                                          | Description                                    |
| ------------------------------------------------------------- | ---------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | False if the entity already had the component. |

### Remarks

This is a structural change.
