Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EntityCommandRecorder is broken for world components #148

Closed
Helco opened this issue Dec 28, 2021 · 1 comment
Closed

EntityCommandRecorder is broken for world components #148

Helco opened this issue Dec 28, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@Helco
Copy link
Contributor

Helco commented Dec 28, 2021

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);
    }
}
@Doraku Doraku added the bug Something isn't working label Jan 2, 2022
@Doraku
Copy link
Owner

Doraku commented Jan 2, 2022

gahhh thanks for reporting, a bad copy/past when I added this feature >_<

@Doraku Doraku closed this as completed in 042222a Jan 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants