Optimization and Do once (SOLVED)

Hi, i am working on a game about clicking and collecting things you clicked, things you collect randomly spawned so they might overlap sometimes and if i use do once it does not count all items, so i use for each object and check cursor colliding option, does it check literally all selectable objects(like 600) for checking or just around tip of cursor and if i use mouse button released condition do i need to use do once or is it already happening once and it does not effect performance?

The for each object event goes through all of the objects unless there are conditions then it goes only through the pick list. That’s why it’s better to put conditions before a for each object. Filter the list first.

Mouse released only triggers once. So, a trigger once isn’t needed with it.

This would only use the objects that were touched.

If you just want 1 object then instead of a for each object you could use pick nearest object as the name implies, it just picks the nearest object.

If you were just trying to count the click objects then you could use the picked instance count expression.

This would add the number of clicked objects to the Count variable.

1 Like

Thanks for detailed explanations i was exactly looking for this answers.

1 Like