-
Notifications
You must be signed in to change notification settings - Fork 144
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
Engine.getEntitiesFor(Family) returning non-matching entities #214
Comments
Could you please provide a jUnit test that highlights the issue? That would make it a lot easier to reproduce and fix. Thanks a lot! |
I'll work on a repro for this soon. I wish I hadn't found it in the midst of "Jam Code" so it was easier to extract :) |
If you don't mind and having limited time these days, I will wait for the test case for this potential bug. Thanks for reporting it though! |
No problem. I'll try to get a unit test or at least a small example project that presents the issue this weekend. The issue exists and is reproducible in this project, but there's quite a bit of code in there, and as the name shows it was started for libgdxjam, so a lot of it is probably a mess: The System where I encountered the bug is: Line 52 is where I had to null check to protect against this issue after the upgrade. |
Adding tests that should recreate the issue. Original issue must be somewhere else in the project original found in.
Issue number libgdx#214 is recreated in this new unit test if the commented line is uncommented. Line 518 in PooledEngineTests.java
I was able to create a unit test to highlight this. PR #217 If I call Entity.removeAll(), and then engine.remove(entity) in that block, I get instances where the engine.getEntitiesFor(Family) returns a component that shouldn't match the family any longer. I don't know if this counts as a bug now, or just bad usage on my part. It seems Entity.removeAll is redundant if you are removing the entity anyway, but not knowing for certain, I was trying to be safe. If I comment out the line that removes the components, I don't get any bad hits. The unit test I've created will have the line commented out so that all tests pass for anyone else that might get this while it's being worked. |
I think this is related, although maybe not the same as #161, which has been around for a while, No one has come up with a nice, clean solution so far. I'm happy to hear new proposals though, as I'd like Ashley to be as robust as possible. |
Family is not picking up entities when recreating engine to swithc contexts. Possibly related to issue 214: libgdx/ashley#214 -ignore local properties
I've been working with Ashley 1.7.0 for a while and it's been running smooth. I just upgraded to 1.7.2 and now I am getting a NullPointer in the code below. When I get the FollowerComponent from an entity in the list of engine.getEntitiesFor(Family.all(FollowerComponent.class).get()), the FollowerCompnent is null.
This shouldn't be possible correct? All of the entities in the returned array should be guaranteed to have the component's required by the Family.
The text was updated successfully, but these errors were encountered: