Hello everybody,
I’m hitting an issue with MassEntity when I try to batch create Entities during processor.
Here is some context.
In one processor I create a batch of entities to store some damage data.
In another processor I bundle this data and then destroy those entities.
I also have some other processor that do mostly the same pattern.
This is how I create the Entities in the processor
const auto DamageHandle = Manager.ReserveEntity();
QueryContext.Defer().PushCommand(
DamageHandle, FDamageFragment{ EntityHandle, EntityHandle,
DamagerFragment.DamageTypes, DamagerFragment.SelfDamage });
After a while, I hit this check in the FMassCommandBuildEntity
check(EntityCollections.Num() <= 1);
if (EntityCollections.Num())
{
System.BatchBuildEntities(EntityCollections[0], Super::FragmentsAffected, FMassArchetypeSharedFragmentValues());
}
From what I understand the issue arise in the FMassArchetypeEntityCollectionWithPayload::CreateEntityRangesWithPayload where for some reason it finds some Archetype linked to the EntityHandle I provided (which should not be the case since those handles should be free from what I understand)
I tried to chain my processors to order them to no avail. I also tried to force all of them in the game thread to make sure all reserve entity are on the same threads but I still have the same issue.
I also found out that for some reason the collections do not contain the same number of elements that were provided.
I honestly have no idea where to go next now and how to fix this, so any help would be greatly appreciated.
I can provide any additionnal information if needed.
Thanks in advance.
Lolo