diff --git a/src/EcsWorld.static.cs b/src/EcsWorld.static.cs index c87882d..9d3b3f9 100644 --- a/src/EcsWorld.static.cs +++ b/src/EcsWorld.static.cs @@ -81,6 +81,7 @@ namespace DCFApixels.DragonECS public static void ResetStaticState() { + var nullworld = _worlds[0]; for (int i = 1; i < _worlds.Length; i++) { var world = _worlds[i]; @@ -92,7 +93,8 @@ namespace DCFApixels.DragonECS } world = null; } - _worlds = Array.Empty(); + _worlds = new EcsWorld[_worldIdDispenser.Capacity]; + _worlds[0] = nullworld; _worldIdDispenser.ReleaseAll(); } diff --git a/src/Internal/IdDispenser.cs b/src/Internal/IdDispenser.cs index 1d4aa21..47e993b 100644 --- a/src/Internal/IdDispenser.cs +++ b/src/Internal/IdDispenser.cs @@ -35,7 +35,7 @@ namespace DCFApixels.DragonECS.Internal [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return _usedCount; } } - public int Size + public int Capacity { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return _size; } @@ -339,7 +339,7 @@ namespace DCFApixels.DragonECS.Internal { get { - Pair[] result = new Pair[_target.Size]; + Pair[] result = new Pair[_target.Capacity]; for (int i = 0; i < result.Length; i++) { result[i] = new Pair( @@ -354,7 +354,7 @@ namespace DCFApixels.DragonECS.Internal { get { - ID[] result = new ID[_target.Size]; + ID[] result = new ID[_target.Capacity]; for (int i = 0; i < result.Length; i++) { int id = _target._dense[i]; @@ -365,7 +365,7 @@ namespace DCFApixels.DragonECS.Internal } public bool IsValid => _target.IsValid(); public int Count => _target.Count; - public int Size => _target.Size; + public int Capacity => _target.Capacity; public int NullID => _target._nullID; internal readonly struct ID {