Skip to content
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

ReactiveSystem gets wrong entities #25

Closed
jraselin opened this issue Aug 12, 2015 · 3 comments
Closed

ReactiveSystem gets wrong entities #25

jraselin opened this issue Aug 12, 2015 · 3 comments
Labels

Comments

@jraselin
Copy link

Hi,

When GroupEventType.OnEntityRemoved is used with IReactiveSystem, List<Entity> entities parameter on method public void Execute(List<Entity> entities) doesn't correspond to the removed entities (seems to match random entities within the pool)

It would be useful to get the removed components

Regards

@jraselin jraselin changed the title GroupEventType.OnEntityRemoved use in IReactiveSystem GroupEventType.OnEntityRemoved used in IReactiveSystem Aug 12, 2015
@JuDelCo
Copy link

JuDelCo commented Aug 13, 2015

The real problem is destroyed entities (not just his components) will be reused to create another entity. It works like any component or entity instantiated (well, components too but only if you use the code generator !) will be used as a cache object to "instantiate" new ones if they are "destroyed".

GroupObservers (and by extension, ReactiveSystems...) WILL NOT notice this, they just think the entity not match his requirements so they keep anyways a reference of them (if they matched before)

That's why in the examples provided in sschmid acount (the match-one and the cars one) they built a "DestroySystem" which executes at the very end of the loop, destroying in that moment any entity with the component "DestroyComponent".

@jraselin
Copy link
Author

Thanks for your explanation.

For now, I won't use GroupEventType.OnEntityRemoved but only GroupEventType.OnEntityAdded.

Regards

@sschmid sschmid changed the title GroupEventType.OnEntityRemoved used in IReactiveSystem ReactiveSystem gets wrong entities Aug 23, 2015
@sschmid sschmid added bug and removed question labels Aug 23, 2015
@sschmid
Copy link
Owner

sschmid commented Aug 23, 2015

Next release 0.22.0 will solve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

3 participants