Download

"Switch On Class" Blueprint

Hi! For my game I’m trying to make the blueprint code for when you pickup something on the ground. I have it set so that after you come into range and press a certain key, it gets the result of a sphere trace. I want to get the class of the hit actor, and then switch into different possibilities based on the other class. Currently the way I’m doing it is using a bunch of branch statements, but it looks ugly and is a bit annoying. I think it would be really nice if I could switch on class, unless there is some reason why this couldn’t work? Or at least some way of making the class name into a string, and then I could do switch on string. Any of these works for me :slight_smile:

Thanks!

make a enum
use switch on enum