Best way to pick an object from scene

Currently , i am picking the object i want like this


I am giving unique ids to every object in the beginning of the scene. those objects are different objects individually , but they all grouped into planets group. so i want to pick players touching planet and do operations with it . The best solution i can find is above. But there may be 100 planet object and that means 100n for loop in every frame.
How can i directly use object reference in the event sheet ?

You don’t need the repeat block. Just using the condition itself will select only the planet with the matching ID, and the actions will only work on that planet:

1 Like

Wow i didn’t know that thanks , so using a group in condition automatically iterate all instances of that group did i get it right ?

I doesn’t iterate. The condition filters the list of candidate objects to just those that meet the criteria. If there’s just one planet with the id, then the above event is fine.

But if the conditions result in multiple objects, then you’d need to put a repeat for each object as a subevent, along with the actions.

I prefer this method because you’re reducing the number of objects to iterate over. I suspect that (and I’m 100% not sure here) a repeat block with a condition will go over each object and checks if it meets the condition.

2 Likes