From 85100b7d62414927122761c93be886d5e439a259 Mon Sep 17 00:00:00 2001 From: DCFApixels <99481254+DCFApixels@users.noreply.github.com> Date: Thu, 1 May 2025 12:14:41 +0800 Subject: [PATCH 1/2] fix DebugService --- src/DebugUtils/EcsDebug.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DebugUtils/EcsDebug.cs b/src/DebugUtils/EcsDebug.cs index 0f5608e..e128b0a 100644 --- a/src/DebugUtils/EcsDebug.cs +++ b/src/DebugUtils/EcsDebug.cs @@ -247,7 +247,7 @@ namespace DCFApixels.DragonECS #region Static Constructor static DebugService() { -#if !UNITY_5_3_OR_NEWER +#if UNITY_5_3_OR_NEWER Set(new NullDebugService()); #else Set(new DefaultDebugService()); From 2595c25db410af8fb338dfa867b7044ecc0f72fe Mon Sep 17 00:00:00 2001 From: DCFApixels <99481254+DCFApixels@users.noreply.github.com> Date: Thu, 1 May 2025 14:48:44 +0800 Subject: [PATCH 2/2] Update EcsPool.cs --- src/Pools/EcsPool.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Pools/EcsPool.cs b/src/Pools/EcsPool.cs index 3cc73f4..375257a 100644 --- a/src/Pools/EcsPool.cs +++ b/src/Pools/EcsPool.cs @@ -95,6 +95,7 @@ namespace DCFApixels.DragonECS { ref int itemIndex = ref _mapping[entityID]; #if DEBUG + if (entityID == EcsConsts.NULL_ENTITY_ID) { Throw.Ent_ThrowIsNotAlive(_source, entityID); } if (_source.IsUsed(entityID) == false) { Throw.Ent_ThrowIsNotAlive(_source, entityID); } if (itemIndex > 0) { EcsPoolThrowHelper.ThrowAlreadyHasComponent(entityID); } if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); } @@ -144,6 +145,9 @@ namespace DCFApixels.DragonECS } public ref T TryAddOrGet(int entityID) { +#if DEBUG + if (entityID == EcsConsts.NULL_ENTITY_ID) { Throw.Ent_ThrowIsNotAlive(_source, entityID); } +#endif ref int itemIndex = ref _mapping[entityID]; if (itemIndex <= 0) { //Add block @@ -185,6 +189,7 @@ namespace DCFApixels.DragonECS { ref int itemIndex = ref _mapping[entityID]; #if DEBUG + if (entityID == EcsConsts.NULL_ENTITY_ID) { Throw.Ent_ThrowIsNotAlive(_source, entityID); } if (itemIndex <= 0) { EcsPoolThrowHelper.ThrowNotHaveComponent(entityID); } if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); } #elif DRAGONECS_STABILITY_MODE @@ -237,9 +242,8 @@ namespace DCFApixels.DragonECS #elif DRAGONECS_STABILITY_MODE if (_isLocked) { return; } #endif - _recycledItemsCount = 0; // спереди потому чтобы обнулялось, так как Del не обнуляет + _recycledItemsCount = 0; // спереди чтобы обнулялось, так как Del не обнуляет if (_itemsCount <= 0) { return; } - _itemsCount = 0; var span = _source.Where(out SingleAspect _); foreach (var entityID in span) { @@ -251,6 +255,8 @@ namespace DCFApixels.DragonECS _listeners.InvokeOnDel(entityID, _listenersCachedCount); #endif } + _itemsCount = 0; + _recycledItemsCount = 0; } #endregion