Set enum to name

Hi,

I don’t even know if this is possible, or if I’m doing this the most optimized way. I’m coming from an animation and anim blueprint background so I’m treading into unknown waters here.

What I want…

I have a cube, when my player collides with the cube something different happens depending on which side the player collides with. For example, front vs back, collide with the front of the box and one thing happens. Collide with the back, something different.

How I am setup…

To ensure no spelling errors and because there will be many possible collision types in the future I made an enumerator, it is called TestBox_enum. There are three values right now - !Blank! (default/error checking), Front, and Back

I made a static mesh cube and put two box simplified collisions on it called TestBox_front_col and TestBox_Back_col, I scaled and placed one at the front and one at the back of the cube. It is called TestBox_static

I made a blueprint called “TestBox_BP” and added TestBox_static to it. I also made two TestBox_enum variables on TestBox_BP called Front Tag and Back Tag. I set the default values of these variables to be “Front” and “Back” respectively.

In the construction script for TestBox_BP I am getting the tags for each collision box and adding the name of corresponding enum value.
TestBox_Front_col > get component tags > Add value of Front Tag
TestBox_Back_col > get component tags > Add value of Back Tag

With me so far?So on to the player.

The player has an Event Hit that gets the tags of the object she hit and I want to take that value and set a local TestBox_enum variable on the player to that value. Then run a switch on the value of the local TestBox_enum.

My problem…

I don’t know how to set the value of an enum to that of a name.

Why am I doing it this way…

It’s what I was able to figure out. Also as I make more collision options I can just update the enum and everywhere I am using that enum will automatically know about the new value. Also I don’t have to worry about spelling errors.

Thanks for any help (especially if you made it this far)

Russ