sebas77/Svelto.ECS

Multiple FindGroups Issue

simeonradivoev opened this issue · 3 comments

If you call FindGroups multiple times with different types in the same method, the previous results get changed.
You can't cache the results in the same method.

var groups1 = entitiesDB.FindGroups<Component>();
var groups2 = entitiesDB.FindGroups<Component2>();

group1 takes the value of group2.

Shouldn't there be a more clear indicator that the return value is a singleton list?

We unintentionally ran into this issue as well, but avoided it for now by reordering a couple of things. It would be good to improve how this is shown to the user

this was by design as I couldn't find a reason to call FindGroups multiple times.
remember that you can do FindGroups<component, component2> if you needed an intersection.
If not, you need to use QueryGroups to do more complex operations with group sets .

it would be nice to find a way to validate that it's used improperly.

also nothing stops us from adding an overload that accepts a Span<T> as parameter