Closed ZumiKua closed 4 years ago
The example code actually outputs
SystemAttachComponent 1
SystemC 1
I'm not exactly sure how the example should demonstrate the described problem, but I definitely see a mistake in the usage of engine.getEntitiesFor()
. From the method's javadoc:
Returns immutable collection of entities for the specified {@link Family}. Will return the same instance every time.
You shouldn't keep the reference to the returned collection, but instead, persist the result using your own instance.
@metaphore it actually returns the same instance for a given Family filter, it's the typical usage, just like in IteratingSystem.
@ZumiKua and @metaphore which versions are you testing this code against? my guess is it's fixed in master branch.
@mgsx-dev doh, I should really dig deeper than javadocs haha. Thanks for pointing out.
Hard to tell which commit I'm on, I'm using 1.7.4-SNAPSHOT
.
i can confirm it's fixed, @ZumiKua you can use either 1.7.4-SNAPSHOT or jitpack: "com.github.libgdx:ashley:master-SNAPSHOT"
@metaphore i'll improve the javadoc, it's a bit confusing indeed :-)
Sorry for my late reply, I'm using 1.7.3
, which is bundled with the newest(I guess) gdx-setup.
Maybe gdx-setup needs to be updated?
Anyway, thanks for your help ❤️
With the above code, SystemAttachComponent receives zero entities, but SystemC receives one entity, is this a bug or an intended behavior?