Closed
Description
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);
}
}