Entity.AddChild(Entity).md

July 25, 2024 ยท View on GitHub

Friflo.Engine.ECS

Friflo.Engine.ECS.Entity

Entity.AddChild(Entity) Method

Add the given entity as a child to this entity.
See Example.

public int AddChild(Friflo.Engine.ECS.Entity entity);

Parameters

entity Entity

Returns

System.Int32
The index within ChildIds the entity is added.
-1 if the entity is already a child entity.

Remarks

Executes in O(1) in case the child has no parent.
The subtree structure of the added entity remains unchanged.
To iterate all entities with child entities use TreeNode in a Query().