UE4: Overlapping event for multiple classes

We’re working on a small Unreal Engine game. For this purpose, I’ve need the possibility to check for overlapping events of the character with multiple blueprints (obstacles etc.). The problem is I haven’t found a possibility yet to check an overlapping event for multiple classes (let’s say BPObstacle1, BPObstacle2 and so on) - the only thing I can achieve is to proof if the character overlaps with one specific class. In other words, i need some kind of a “class switcher” or “class dispatcher” to proof for multiple classes.

Now someone could ask, why not simply add an overlap event to the obstacles instead of the character? This is because the liftetime of the object (BPObstacles) need to be longer. For example, I need to destroy an actor (BPObstacle) before a sound starts to play. None of the blocks are executed after an “Destroy actor” command, so you can’t play a sound after the actor (BPObstacle) was destroyed.

The temporary workaround for me is to duplicate the capsule component of the character, this gives me the possibility to add one overlapping event for each capsule (and so for a collision with each different obstacle). This is something most of the people needed I think, but I haven’t found a better way to achieve this. Would be nice if someone has a tip for me.

Kind regards

You can use an array of classes with classes of blueprints. when you overlap a blueprint, you check if your array “contains” this class. If you need to extract specific info, you may then will have or to use multi cast or a switch, using index of array to list dedicated “cast to”.

Hi Fen!

That was exact the idea I was looking for! Thank you very much, it works now as expected!

PS: I would have uploaded my solution (short snippet to the thread), but neither in firefox nor in chrome the image upload from computer works…

I am happy that helped you ^^

Your image is too big. Reduce size / quality to have it less than 200k

Ah now I got it - the “Upload Files” is not highlighted as button, can’t rather distinguish it to normal text :slight_smile:
However, thank you again for your quick help. Finally, here’s the snippet I used (obstacles is the array consisting of the blueprint classes).