diff --git a/src/Pools/EcsPool.cs b/src/Pools/EcsPool.cs index d98888e..828c021 100644 --- a/src/Pools/EcsPool.cs +++ b/src/Pools/EcsPool.cs @@ -100,6 +100,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(); } @@ -156,6 +157,9 @@ namespace DCFApixels.DragonECS } +#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 @@ -195,6 +199,7 @@ namespace DCFApixels.DragonECS { ref int removedItemIndex = ref _mapping[entityID]; #if DEBUG + if (entityID == EcsConsts.NULL_ENTITY_ID) { Throw.Ent_ThrowIsNotAlive(_source, entityID); } if (removedItemIndex <= 0) { EcsPoolThrowHelper.ThrowNotHaveComponent(entityID); } if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); } #elif DRAGONECS_STABILITY_MODE @@ -265,7 +270,6 @@ namespace DCFApixels.DragonECS if (_isLocked) { return; } #endif if (_itemsCount <= 0) { return; } - _itemsCount = 0; var span = _source.Where(out SingleAspect _); foreach (var entityID in span) { @@ -277,6 +281,8 @@ namespace DCFApixels.DragonECS _listeners.InvokeOnDel(entityID, _listenersCachedCount); #endif } + _itemsCount = 0; + _recycledItemsCount = 0; } #endregion