fix issue with reading pending component

pull/5/head
Evan Hemsley 2019-08-10 18:17:52 -07:00
parent df27c78e02
commit 1ce6e0e907
1 changed files with 12 additions and 1 deletions

View File

@ -223,7 +223,18 @@ namespace Encompass
var existingRead = receiveTypes.Contains(typeof(ComponentMessage<TComponent>)); var existingRead = receiveTypes.Contains(typeof(ComponentMessage<TComponent>));
if (existingRead && pendingRead) if (existingRead && pendingRead)
{ {
return componentMessageManager.ReadPendingComponentByEntityAndType<TComponent>(entity); if (componentMessageManager.HasPendingComponent<TComponent>(entity))
{
return componentMessageManager.ReadPendingComponentByEntityAndType<TComponent>(entity);
}
else if (componentMessageManager.HasExistingComponent<TComponent>(entity))
{
return componentMessageManager.ReadExistingComponentByEntityAndType<TComponent>(entity);
}
else
{
throw new NoComponentOfTypeOnEntityException("No Component of type {0} exists on Entity {1}", typeof(TComponent).Name, entity.ID);
}
} }
else if (existingRead) else if (existingRead)
{ {