diff --git a/encompass-cs/ComponentBitSet.cs b/encompass-cs/ComponentBitSet.cs index 7ec25f4..3b40794 100644 --- a/encompass-cs/ComponentBitSet.cs +++ b/encompass-cs/ComponentBitSet.cs @@ -52,7 +52,10 @@ namespace Encompass public void RemoveComponent(Entity entity) where TComponent : struct, IComponent { - entities[entity].Set(TypeToIndex[typeof(TComponent)], false); + if (entities.ContainsKey(entity)) + { + entities[entity].Set(TypeToIndex[typeof(TComponent)], false); + } } public void RemoveEntity(Entity entity)