Object exists in a group condition

Object groups already have a list of all the objects in them, so it would be helpful if there’s a condition to check if an object exists in a group.

img

My solution was to do a For each Group and list the names in a temporary array, then check if the object’s name exist in this array. But this also won’t pick the Object that exists in this group.

But since groups already have lists of the objects in them, the condition can simply check in the existing lists, pick the objects that exist in this group and return True or False.

3 Likes

i woul add if Object named “” exists in a grp.
as optional field.

Noiw that i think…you probably not going to needc that…
upvoted anyway

2 Likes

In which cases do you need this?

Let’s say you have objects that are in multiple groups. Ex a tree object added to 3 groups, StaticObjects - WorldObjects - Resources. Other than using the groups in events, they can also be used as categories or classes.

Ex if I have an event for StaticObjects and I want some actions to only affect StaticObjects that are Resources (like the tree object), then I can check if StaticObject is in the group Resources. Sure I can declare a variable to the Resources group and use it to check, but if the variable is not needed for other purposes, then it would be simpler to just check using the condition.

It may be even more useful than in my example, but I thought I’d suggest it.

1 Like

You could define a group StaticObjectsThatAreResources.

1 Like