Skip to content

Component Class

Definition

Namespace: Brine2D.ECS

Base class for all components - pure data containers. For logic, use Behavior or Systems.

C#
public abstract class Component

Inheritance System.Object → Component

Derived
↳ AnimatorComponent
↳ BuoyancyZoneComponent
↳ JointComponent
↳ KinematicCharacterBody
↳ PhysicsBodyComponent
↳ TransformComponent
↳ VelocityComponent
↳ AIControllerComponent
↳ AudioListenerComponent
↳ AudioSourceComponent
↳ PlayerControllerComponent
↳ CameraFollowComponent
↳ ParticleEmitterComponent
↳ ShapeComponent
↳ SpriteComponent
↳ TilemapComponent

Properties
Entity The entity this component is attached to.
IsEnabled Whether this component is enabled. Checked by built-in systems \(rendering, physics, collision, audio, AI, particles\) to skip processing of individual components without removing them. Custom systems should check this property when processing components.
Methods
OnAdded() Called when the component is added to an entity.
OnDisabled() Called when this component transitions from enabled to disabled \(i\.e\., [IsEnabled](IsEnabled.md 'Brine2D\.ECS\.Component\.IsEnabled') changes to [false](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool 'https://docs\.microsoft\.com/en\-us/dotnet/csharp/language\-reference/builtin\-types/bool')\). Also called when the owning entity transitions from active to inactive \([IsActive](../Entity/IsActive.md 'Brine2D\.ECS\.Entity\.IsActive') changes to [false](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool 'https://docs\.microsoft\.com/en\-us/dotnet/csharp/language\-reference/builtin\-types/bool')\) and this component's IsEnabled is already true. Override to pause state, stop effects, or clear accumulators.
OnEnabled() Called when this component transitions from disabled to enabled \(i\.e\., [IsEnabled](IsEnabled.md 'Brine2D\.ECS\.Component\.IsEnabled') changes to [true](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool 'https://docs\.microsoft\.com/en\-us/dotnet/csharp/language\-reference/builtin\-types/bool')\). Also called when the owning entity transitions from inactive to active \([IsActive](../Entity/IsActive.md 'Brine2D\.ECS\.Entity\.IsActive') changes to [true](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool 'https://docs\.microsoft\.com/en\-us/dotnet/csharp/language\-reference/builtin\-types/bool')\) and this component's IsEnabled is already true. Override to resume state or restart effects.
OnRemoved() Called when the component is removed from an entity.