Table of Contents

Entity

The Entity struct provides access to an entity's components, tags, links, and lifetime.

Components are explored in depth on the component page.

Caution

References returned by Get<T>(), including Ref<T> values from TryGet<T>(), point directly into component storage. Treat them as invalid after a structural change.

Tags

What if you wanted to have a component as a marker, but not to actually hold any data or behavior? This is where tags come in. Tags are any type T that you can add to/detach from an entity. To check if an entity has a tag, use the Tagged method.

Tip

See the API Reference for all Entity APIs. Unfamiliar with ref? See the C# language reference.

Liveness check

You can check if an entity is alive or not explicitely or implicitely:

// Explicit check
if (entity.IsAlive)
{
    // The entity is alive!
}

// Implicit check
if (entity)
{
    // The entity is also alive!
}