Arch
                                
                                
                                
                                    Arch copied to clipboard
                            
                            
                            
                        World Destruction / Corruption via Destroyed World Reference
If a world is destroyed and then "destroyed" again after another world has replaced it (occupying the unused world ID), the second world won't actually be able to create entities anymore. It will track its size as if it can, and will create entity objects with the right ids and archetype, but the entities will be evaluated as null. Exceptions won't be thrown until the Entity is accessed in some way.
var worldA = World.Create(); // World A has ID 0 and size 0
worldA.Create(); // worldA is now size 1
World.Destroy(worldA); // world A is size 0
var worldB = World.Create(); // World B has ID 0 and size 0
var e0 = worldB.Create(0); // world B now has size 1
World.Destroy(worldA); // World B still appears to have size 1
var e1 = worldB.Create(0); // World B has size 2
e0.Get<int>(); // This causes a null reference exception
e1.Get<int>(); // This also causes a null reference exception