From 5ba5b7094d266d72dc9342f1573222279c9436c7 Mon Sep 17 00:00:00 2001 From: DCFApixels <99481254+DCFApixels@users.noreply.github.com> Date: Mon, 10 Mar 2025 22:36:12 +0800 Subject: [PATCH] rename DestroyAndClearAllWorlds to ResetStaticState --- src/EcsWorld.static.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/EcsWorld.static.cs b/src/EcsWorld.static.cs index 02002fe..2798fd8 100644 --- a/src/EcsWorld.static.cs +++ b/src/EcsWorld.static.cs @@ -21,7 +21,7 @@ namespace DCFApixels.DragonECS #endregion private static EcsWorld[] _worlds = Array.Empty(); - private static IdDispenser _worldIdDispenser = new IdDispenser(4, 0, n => Array.Resize(ref _worlds, n)); + private static readonly IdDispenser _worldIdDispenser = new IdDispenser(4, 0, n => Array.Resize(ref _worlds, n)); private static StructList _allWorldComponentPools = new StructList(64); private StructList _worldComponentPools; @@ -66,7 +66,7 @@ namespace DCFApixels.DragonECS return ref WorldComponentPool.GetForWorldUnchecked(worldID); } - public static void DestroyAndClearAllWorlds() + public static void ResetStaticState() { for (int i = 1; i < _worlds.Length; i++) { @@ -79,6 +79,7 @@ namespace DCFApixels.DragonECS } world = null; } + _worldIdDispenser.ReleaseAll(); } #region WorldComponentPool