Skip to content

IEntityWorld.GetEntitiesByTag Method

Definition

Namespace: Brine2D.ECS

Overloads
GetEntitiesByTag\(string\) Gets all active entities with a specific tag.
GetEntitiesByTag\(string, bool\) Gets entities with a specific tag, optionally including inactive entities.

IEntityWorld.GetEntitiesByTag\(string\) Method

Gets all active entities with a specific tag.

C#
System.Collections.Generic.IEnumerable<Brine2D.ECS.Entity> GetEntitiesByTag(string tag);

Parameters

tag System.String

Returns

System.Collections.Generic.IEnumerable<Entity>

Remarks

Only active entities are returned. To include inactive entities, use the includeInactive overload. Returns a materialized list built from the internal tag index in O\(matching entities\). For per-frame use, prefer ForEachWithTag\(string, Action<Entity>\) or a cached query to avoid allocating a new list each call.

IEntityWorld.GetEntitiesByTag\(string, bool\) Method

Gets entities with a specific tag, optionally including inactive entities.

C#
System.Collections.Generic.IEnumerable<Brine2D.ECS.Entity> GetEntitiesByTag(string tag, bool includeInactive);

Parameters

tag System.String

The tag to search for.

includeInactive System.Boolean

When true, inactive entities are also returned. Defaults to false to match the no-arg overload.

Returns

System.Collections.Generic.IEnumerable<Entity>

Remarks

Returns a materialized list built from the internal tag index in O\(matching entities\). For per-frame use, prefer ForEachWithTag\(string, Action<Entity>\) or a cached query to avoid allocating a new list each call.