Skip to content

IEntityWorld.GetEntityByName Method

Definition

Namespace: Brine2D.ECS

Overloads
GetEntityByName\(string\) Gets an entity by name \(returns first match\).
GetEntityByName\(string, bool\) Gets an entity by name \(returns first match\), optionally including inactive entities.

IEntityWorld.GetEntityByName\(string\) Method

Gets an entity by name \(returns first match\).

C#
Brine2D.ECS.Entity? GetEntityByName(string name);

Parameters

name System.String

Returns

Entity

Remarks

Only active entities are returned. To include inactive entities use the includeInactive overload. This is O\(n\); prefer ID-based lookup via GetEntityById\(long\) on hot paths. Entities created in the same frame but not yet committed by Flush() are also searched, so this method returns a newly-created entity immediately without requiring a Flush() call first.

IEntityWorld.GetEntityByName\(string, bool\) Method

Gets an entity by name \(returns first match\), optionally including inactive entities.

C#
Brine2D.ECS.Entity? GetEntityByName(string name, bool includeInactive);

Parameters

name System.String

The name to search for.

includeInactive System.Boolean

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

Returns

Entity

Remarks

This is O\(n\); prefer ID-based lookup via GetEntityById\(long\) on hot paths. Entities created in the same frame but not yet committed by Flush() are also searched, so this method returns a newly-created entity immediately without requiring a Flush() call first.