# Entity

> Identifies an entity.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule
* **Implements:** [IEquatable\<Entity>](https://learn.microsoft.com/dotnet/api/system.iequatable-1), [IComparable\<Entity>](https://learn.microsoft.com/dotnet/api/system.icomparable-1)

```csharp
public struct Entity : IEquatable<Entity>, IComparable<Entity>
```

## Remarks

The entity is a fundamental part of the Entity Component System. Everything in your application that has data or an identity of its own is an entity. However, an entity doesn't contain either data or behavior itself. Instead, the data is stored in the components and the behavior is provided by the systems that process those components. The entity acts as an identifier or key to the data stored in components.

The [EntityManager](/engine/7000.0/script-reference/unity/entities/entitymanager.md) class manages entities and they exist within a [World](/engine/7000.0/script-reference/unity/entities/world.md). An Entity struct refers to an entity, but isn't a reference. Rather, the Entity struct contains an [Entity.Index](/engine/7000.0/script-reference/unity/entities/entity/index.md) that you can use to access entity data, and a [Entity.Version](/engine/7000.0/script-reference/unity/entities/entity/version.md) that you can use to check whether the Index is still valid. Note that you must pass the Index or Version values to\
relevant API methods, rather than accessing them directly.

To add or remove components, access components, or to destroy the entity, pass an Entity struct to methods of the [EntityManager](/engine/7000.0/script-reference/unity/entities/entitymanager.md), the [EntityCommandBuffer](/engine/7000.0/script-reference/unity/entities/entitycommandbuffer.md), or the [ComponentSystemBase](/engine/7000.0/script-reference/unity/entities/componentsystembase.md).

## Properties

| Property                                                                    | Description                             |
| --------------------------------------------------------------------------- | --------------------------------------- |
| [Index](/engine/7000.0/script-reference/unity/entities/entity/index.md)     | The ID of an entity.                    |
| [Version](/engine/7000.0/script-reference/unity/entities/entity/version.md) | The generational version of the entity. |

## Static Properties

| Property                                                              | Description                                                      |
| --------------------------------------------------------------------- | ---------------------------------------------------------------- |
| [Null](/engine/7000.0/script-reference/unity/entities/entity/null.md) | A "blank" Entity object that does not refer to an actual entity. |

## Methods

| Method                                                                                  | Description                                                  |
| --------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| [CompareTo](/engine/7000.0/script-reference/unity/entities/entity/compareto.md)         | Compare this entity against a given one                      |
| [Equals](/engine/7000.0/script-reference/unity/entities/entity/equals.md)               | Entity instances are equal if they refer to the same entity. |
| [GetHashCode](/engine/7000.0/script-reference/unity/entities/entity/gethashcode.md)     | A hash used for comparisons.                                 |
| [ToFixedString](/engine/7000.0/script-reference/unity/entities/entity/tofixedstring.md) | Provides a Burst compatible debugging string.                |
| [ToString](/engine/7000.0/script-reference/unity/entities/entity/tostring.md)           | Provides a debugging string.                                 |

## Operators

| Operator                                                                              | Description                                                         |
| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| [operator ==](/engine/7000.0/script-reference/unity/entities/entity/op-equality.md)   | Entity instances are equal if they refer to the same entity.        |
| [EntityId](/engine/7000.0/script-reference/unity/entities/entity/op-implicit.md)      | Converts an entity to the EntityId with the same index and version. |
| [operator !=](/engine/7000.0/script-reference/unity/entities/entity/op-inequality.md) | Entity instances are equal if they refer to the same entity.        |
