Description
Hi,
When there are multiple collectors defined as triggers within a MultiReactiveSystem
and more than one is met, Entitas throws an EntityIsAlreadyRetainedByOwnerException
. It's possible that I might not be using the MultiReactiveSystem
as it's intended to be, but I think that the exception should not be the expected behaviour in cases like this. Probably the best would be to simply not retain it again (or duplicate its reference) in the execution list.
protected override ICollector[] GetTrigger(Contexts contexts)
{
return new ICollector[] {
contexts.gameState.CreateCollector(Matcher.A.AddedOrRemoved()),
contexts.gameState.CreateCollector(Matcher.B.Removed())
};
}
The typical case where I'm experiencing this issue is when I've one entity with both A
and B
components and I remove both of them in the same frame. I can't listen to just one of them because there are other cases where A
and B
might be removed separately.
Is there a solution or turn around for this, or maybe this is more of a conceptual discussion regarding the API behaviour?
Cheers and thanks in advance!
Metadata
Metadata
Assignees
Labels
Projects
Status