IComponent.md

November 22, 2024 · View on GitHub

Friflo.Engine.ECS

Friflo.Engine.ECS

IComponent Interface

To enable adding a struct component to an Entity it need to implement IComponent.
IComponent types are structs which only contains data but no script / methods.
See Example.

public interface IComponent

Derived
EntityName
IIndexedComponent<TValue>
ILinkComponent
Position
Rotation
Scale3
Transform
TreeNode
UniqueEntity
Unresolved

Remarks

An Entity can contain multiple components but only one of each type.

Optionally attribute the implementing struct with ComponentKeyAttribute
to assign a custom component key name used for JSON serialization.

Common game specific IComponent types defined by the Engine: