New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GroupEventType.OnEntityRemoved is also triggered when replacing a component #24
Comments
The thing about groups (at least as far as I know) they do not really respond to the entity being added/removed but to each individual component. So in your PlayerSelectActionAttackSytem you replace the position of the entity, therefore triggering all the groups again. In effect the replace triggers the remove event first (since the old position is removed) and then the add event (since the new position is added). I hope that makes things a little bit clearer and helps you solve the problem. |
An entity is part of a group, when it fulfills the requirements of the matcher. In your case Group group = pool.GetGroup(Matcher.AllOf(Matcher.PlayerSelectActionAttack, Matcher.Position));
onAdded = group.CreateObserver (GroupEventType.OnEntityAdded);
onRemoved = group.CreateObserver (GroupEventType.OnEntityRemoved); an entity belongs to a group when it has a |
Btw, |
Thanks for yours responses Now, I understand the concept of ReplaceComponent
Ok, I will remove all UI Logic and create dedicated systems Regards |
Hi,
Below is the project configuration :
Position
PlayerSelectActionAttack
AttackPointerController
AttackController
PlayerSelectActionAttackSystem
Expected behaviours
Console Log
AttackPointerController onRemoved.collectedEntities must be empty but the console log shows :
It seems like observers ignores the GroupEventType and populate onRemoved = group.CreateObserver (GroupEventType.OnEntityRemoved); with the newly created entity
Another issue
When the Entity created in AttackController is destroyed (pool.DestroyEntity(attackSelectedEntity)), there are an Exception on AttackPointerController
Regards
The text was updated successfully, but these errors were encountered: