run Filter callbacks before updating component storage
parent
4268762a0c
commit
c68e16456e
|
@ -19,8 +19,9 @@ namespace MoonTools.ECS
|
||||||
{
|
{
|
||||||
if (EntityStorage.RemoveComponent(entity.ID, ComponentTypeIndices.GetIndex<TComponent>()))
|
if (EntityStorage.RemoveComponent(entity.ID, ComponentTypeIndices.GetIndex<TComponent>()))
|
||||||
{
|
{
|
||||||
ComponentDepot.Remove<TComponent>(entity.ID);
|
// Run filter storage update first so that the entity state is still valid in the remove callback.
|
||||||
FilterStorage.Check<TComponent>(entity.ID);
|
FilterStorage.Check<TComponent>(entity.ID);
|
||||||
|
ComponentDepot.Remove<TComponent>(entity.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,9 @@ namespace MoonTools.ECS
|
||||||
{
|
{
|
||||||
foreach (var componentTypeIndex in EntityStorage.ComponentTypeIndices(entity.ID))
|
foreach (var componentTypeIndex in EntityStorage.ComponentTypeIndices(entity.ID))
|
||||||
{
|
{
|
||||||
ComponentDepot.Remove(entity.ID, componentTypeIndex);
|
// Run filter storage update first so that the entity state is still valid in the remove callback.
|
||||||
FilterStorage.RemoveEntity(entity.ID, componentTypeIndex);
|
FilterStorage.RemoveEntity(entity.ID, componentTypeIndex);
|
||||||
|
ComponentDepot.Remove(entity.ID, componentTypeIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var relationTypeIndex in EntityStorage.RelationTypeIndices(entity.ID))
|
foreach (var relationTypeIndex in EntityStorage.RelationTypeIndices(entity.ID))
|
||||||
|
|
Loading…
Reference in New Issue