Skip to content

Delete and modify in same command buffer playback causes exception #106

@JannikGDev

Description

@JannikGDev

Given the follow very simple example, using Friflo.Engine.ECS 3.4.2

using Friflo.Engine.ECS;

var store = new EntityStore();
var entity1 = store.CreateEntity(new Position());

CommandBuffer cb = store.GetCommandBuffer();
cb.RemoveComponent<Position>(entity1.Id);
cb.DeleteEntity(entity1.Id);
cb.Playback();

Will result in this exception:

Assemblies loaded: 73, duration: 48 ms, engine-dependants: [Friflo.Engine.ECS (9),  ConsoleApp1 (0)]
Unhandled exception. System.InvalidOperationException: Playback - entity not found. command: entity: 1 - Remove [Position]
   at Friflo.Engine.ECS.ComponentCommands`1.UpdateComponentTypes(Playback playback, Boolean storeOldComponent)
   at Friflo.Engine.ECS.CommandBuffer.PrepareComponentCommands(Playback playback)
   at Friflo.Engine.ECS.CommandBuffer.Playback()
   at Program.<Main>$(String[] args) in [Redacted]\ConsoleApp1\ConsoleApp1\Program.cs:line 9

It also happens when you have multiple other components or just add a component, it seems deleting an entity in the same command buffer playback as modifiying its components per Add/RemoveComponent causes this exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions