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.
RelEcs/src/Identity.cs
Lines 27 to 32 in a9051ae
Inside Despawn() we queue up the "unused" id without incrementing the generation
RelEcs/src/Archetypes.cs
Line 74 in a9051ae
and then inside Spawn() we pop that id without incrementing the generation
RelEcs/src/Archetypes.cs
Line 37 in a9051ae
Additionally, functions like IsAlive() do not check the generation at all
RelEcs/src/Archetypes.cs
Lines 282 to 285 in a9051ae
It's easy to reproduce this issue since the despawned ids are used immediately
The same issue exists in HypEcs Byteron/HypEcs#4
The text was updated successfully, but these errors were encountered: