Skip to content

EntityCommandRecorder is broken for world components #148

Closed
@Helco

Description

@Helco

Using the EntityCommandRecorder to record setting components on the world is possible by API but broken, as it produces garbage.

Reproduction:

class SomeSystem
{
    public record struct Data(Entity entity, int value);

    public static void Main(string[] args)
    {
        var world = new World();
        var entity = world.CreateEntity();
        var recorder = new EntityCommandRecorder(1024);
        recorder.Record(entity).Set(new Data(entity, 42));
        recorder.Record(world).Set(new Data(entity, 42));
        recorder.Execute();

        var data = entity.Get<Data>();
        Console.WriteLine("From Entity");
        Console.WriteLine("Entity is " + (entity == data.entity ? "correct" : "broken"));
        Console.WriteLine("Value is " + data.value);

        data = world.Get<Data>();
        Console.WriteLine("\nFrom World");
        Console.WriteLine("Entity is " + (entity == data.entity ? "correct" : "broken"));
        Console.WriteLine("Value is " + data.value);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions