fix worldBuilder being able to set a non-component
continuous-integration/drone/push Build is passing Details

pull/15/head
cosmonaut 2020-08-06 14:11:28 -07:00
parent 0a30dab3c2
commit bdd9f59549
1 changed files with 2 additions and 2 deletions

View File

@ -82,7 +82,7 @@ namespace Encompass
/// <summary> /// <summary>
/// Sets Component data for the specified Component Type on the specified Entity. /// Sets Component data for the specified Component Type on the specified Entity.
/// </summary> /// </summary>
public void SetComponent<TComponent>(Entity entity, in TComponent component) where TComponent : struct public void SetComponent<TComponent>(Entity entity, in TComponent component) where TComponent : struct, IComponent
{ {
RegisterComponentType<TComponent>(); RegisterComponentType<TComponent>();
_startingExistingComponentStore.Set(entity.ID, component); _startingExistingComponentStore.Set(entity.ID, component);
@ -95,7 +95,7 @@ namespace Encompass
} }
} }
internal void RegisterComponentType<TComponent>() where TComponent : struct internal void RegisterComponentType<TComponent>() where TComponent : struct, IComponent
{ {
if (!_typeToIndex.ContainsKey(typeof(TComponent))) if (!_typeToIndex.ContainsKey(typeof(TComponent)))
{ {