You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's easy to reproduce this issue since the despawned ids are used immediately
var entity = world.Spawn().Id();
world.Despawn(entity);
var anotherEntity = world.Spawn().Id();
Assert.IsFalse(entity == anotherEntity); //entity == anotherEntity will return true
Assert.IsTrue(world.IsAlive(anotherEntity));
Assert.IsFalse(world.IsAlive(entity)); // This will of course also be true unexpectedly
Entities have a "generation" associated with them but it is always set to 1 since nothing passes a generation in to the constructor.
HypEcs/src/Identity.cs
Lines 27 to 32 in 2cc54cd
Inside Despawn() we queue up the "unused" id without incrementing the generation
HypEcs/src/Archetypes.cs
Line 75 in 2cc54cd
and then inside Spawn() we pop that id without incrementing the generation
HypEcs/src/Archetypes.cs
Line 37 in 2cc54cd
Additionally, functions like IsAlive() do not check the generation at all
HypEcs/src/Archetypes.cs
Lines 283 to 287 in 2cc54cd
It's easy to reproduce this issue since the despawned ids are used immediately
The same issue exists in RelEcs Byteron/RelEcs#39
The text was updated successfully, but these errors were encountered: