Using "Count(Object)" in a condition selects all Objects

This took me a while to debug because it’s not very intuitive… and I’m not sure it’s a bug, but I’m definitely prepared to open one to demonstrate.
Essentially if you use the “Compare two numbers” condition to do something like:
Count(Object) < 100
Then the actions in the that condition will be against all instances of Object.
Even if you call “Create Object” in that action.
So the workaround I assume is to create a boolean in a separate block using Count… but this seems wrong to me.

Anyone else think I should or shouldn’t open this as a bug?

Technically not a bug, per this: Count Object Condition: Unintended behavior for created objects within sub event · Issue #1981 · 4ian/GDevelop · GitHub

@4ian this has popped up again a few times on the discord over the past few weeks. I think there is a need to change how this condition and expression works (a yes/no for selecting all as part of the condition, and ensuring the expression doesn’t impact object selection for following actions, since that seems to be behaviour unique to that one) or maybe just a “unpick all objects” action and condition?

Only tagging to bring this back up as the github discussion seems to have died out

1 Like

Thanks for the link, I did try searching there first, but I failed… the topic and description are such a good match… I’m embarrassed in my searching skills now.

At least now I know that a “create” adds to the selected objects, that might come in handy.