How to run loop container selection?

Hello, I have objects in my scene with names CM1, CM2, CM3, … CM9, CM10, CM11 and I run the collision event to hit some of them in the scene and execute Custom Action connected to their object-names.

There are few issues with this blueprint setup:

  1. When I hit CM11, CM12, etc it reacts as CM1 all the time, how to avoid it?
  2. I think the better way would be to run ForEachLoop, how it would work with it? I need to collide with certain objects with names and depends on their name do their action. I have only 15-20 objects, but what if there 100 objects
    this node setup would look messy. Who know better way for such conditions?

Thank you.

  1. I was able to fix it renaming object to CM01, CM02… :slight_smile:
  2. Dropbox - File Deleted
    I have stuck with the same thing, I was able to create an array and make selection matching over Contains, but I need to execute CM1, CM2 from other BP, so basically second check for the name, how to do it quickly?
    Thank you.

Something like this would be better than what you have, but not by much:

Having a giant mess of nodes coming off of a switch like this is not ideal. Show us more of your Blueprint for ideas on how to simplify or improve it further.

*GetDisplayName *is for debugging purposes in the editor and will most likely stop working correctly once you package.
I’m under the impression you’re trying to reinvent the wheel here. Why not cast OtherActor and execute its CustomEvent? That’s the whole point of having objects.

If you need your actors to have identifiers, you’ll be better off with using in-built tags or give the actors an ID variable, it can be a string.

I’m assuming you’re creating some kind of puzzle and need to interact with multiple objects. If you need them in an array for ease of manipulation, try something along these lines: