CommandBuffer.md

November 22, 2024 · View on GitHub

Friflo.Engine.ECS

Friflo.Engine.ECS

CommandBuffer Class

A command buffer recording entity changes and execute these changes when calling Playback().
CommandBuffer is not thread safe. To record changes on arbitrary threads use Synced.
See Example.

public sealed class CommandBuffer :
Friflo.Engine.ECS.ICommandBuffer

Inheritance System.Object 🡒 CommandBuffer

Implements ICommandBuffer

Properties
ChildCommandsCountReturn the number of recorded add / remove child commands.
ComponentCommandsCountReturn the number of recorded components commands.
EntityCommandsCountReturn the number of recorded entity commands.
EntityStore
ReuseBufferSet ReuseBuffer = true to reuse a CommandBuffer instance for multiple Playback()'s.
ScriptCommandsCountReturn the number of recorded script commands.
SyncedReturns a command buffer that must be used in parallel queries - executed with RunParallel().
TagCommandsCountReturn the number of recorded tag commands.
Methods
AddChild(int, int)Add the entity with the given childId as a child to the entity with the passed parentId.
AddComponent<T>(int, T)Add the given component with type T to the entity with the passed entityId.
AddComponent<T>(int)Add the IComponent with type T to the entity with the passed entityId.
AddScript<T>(int, T)Add the given script to the entity with the passed entityId.
AddTag<T>(int)Add the ITag with type T to the entity with the passed entityId.
AddTags(int, Tags)Add the tags to the entity with the passed entityId.
Clear()
CreateEntity()Creates a new entity on Playback() which will have the returned entity id.
DeleteEntity(int)Deletes the entity with the passed entityId on Playback().
Playback()Execute recorded entity changes. Playback() must be called on the main thread.
See Example.
RemoveChild(int, int)Remove the child entity with given childId from the parent entity with the the passed parentId.
RemoveComponent<T>(int)Remove the IComponent with type T from the entity with the passed entityId.
RemoveScript<T>(int)Remove the Script of the specified type T from the entity with the passed entityId.
RemoveTag<T>(int)Remove the ITag with type T from the entity with the passed entityId.
RemoveTags(int, Tags)Remove the tags from the entity with the passed entityId.
ReturnBuffer()Return the resources of the CommandBuffer to the EntityStore.
SetComponent<T>(int, T)Obsolete. Same behavior as AddComponent(int,T).
ToString()
Explicit Interface Implementations
Friflo.Engine.ECS.ICommandBuffer.AddComponent<T>(int, T)
Friflo.Engine.ECS.ICommandBuffer.AddTags(int, Tags)
Friflo.Engine.ECS.ICommandBuffer.RemoveTags(int, Tags)
Friflo.Engine.ECS.ICommandBuffer.SetComponent<T>(int, T)