check entity in store before remove component

pull/5/head
Evan Hemsley 2019-12-22 12:00:59 -08:00
parent 5299d6ddad
commit 570b6832ad
1 changed files with 4 additions and 1 deletions

View File

@ -51,9 +51,12 @@ namespace Encompass
} }
public void RemoveComponent<TComponent>(Entity entity) where TComponent : struct, IComponent public void RemoveComponent<TComponent>(Entity entity) where TComponent : struct, IComponent
{
if (entities.ContainsKey(entity))
{ {
entities[entity].Set(TypeToIndex[typeof(TComponent)], false); entities[entity].Set(TypeToIndex[typeof(TComponent)], false);
} }
}
public void RemoveEntity(Entity entity) public void RemoveEntity(Entity entity)
{ {