Remove components for every entity in world.Destroy()

In my situation, it invokes IEcsComponentLifecycle<T> methods
This commit is contained in:
Karpik 2026-01-27 22:46:58 +04:00
parent 4512245e57
commit db6b1d209a

View File

@ -236,6 +236,12 @@ namespace DCFApixels.DragonECS
} }
_isDestroyed = true; _isDestroyed = true;
_listeners.InvokeOnWorldDestroy(); _listeners.InvokeOnWorldDestroy();
foreach (var e in Entities)
{
var count = GetComponentTypeIDsFor_Internal(e, ref _componentIDsBuffer);
var span = _componentIDsBuffer.AsSpan(0, count);
RemoveComponents(e, span);
}
_entityDispenser = null; _entityDispenser = null;
_pools = null; _pools = null;
_nullPool = null; _nullPool = null;