EntityPrefab Class
Definition
Namespace: Brine2D.ECS
A reusable entity template that can be instantiated multiple times. Think of it like a "class" for entities.
Inheritance System.Object → EntityPrefab
| Fields | |
|---|---|
| _componentConfigurators | Component configuration actions \(called after component is added\). |
| Properties | |
|---|---|
| Name | Name of this prefab \(e\.g\., "Player", "Enemy", "Coin"\). |
| Tags | Tags to apply to instantiated entities. |
| Methods | |
|---|---|
| AddBehavior<T>\(Action<T>\) | Adds a behavior of the specified type. The behavior is created with dependency injection when the prefab is instantiated. |
| AddChildPrefab\(EntityPrefab, Action<Entity>\) | Adds a child prefab that will be instantiated and parented to the root entity each time this prefab is instantiated. |
| AddComponent<T>\(Action<T>\) | Adds a component with a configuration action. The action is called after the component is added to configure its properties. |
| AddTag\(string\) | Adds a tag to be applied to instantiated entities. |
| AddTags\(string\[\]\) | Adds multiple tags to be applied to instantiated entities. |
| ContainsPrefab\(EntityPrefab, EntityPrefab\) | Returns true when target appears anywhere in the child-prefab graph rooted at root \(depth\-first, cycle\-safe\). |
| Instantiate\(IEntityWorld, Nullable<Vector2>, Nullable<float>, Nullable<Vector2>, ILogger, string\) | Instantiates this prefab as a new entity. |