String to Enum blueprint

Hello,

is it possible to select from a String an enum, so that I give a String and get an enum in blueprint?

Thanks. Jojii.

You could try Set Value as Enum, but I’m not sure it has the same properties as if you were to parse a string as an enum. Otherwise, if you know C++ it wouldn’t be too hard to write a function that could parse enums.

81894-capture.png

I know programmlanuages like java and so on, I know the basics of C++, but I can’t programm this in UE4

Have you at least tried to use Set Value as Enum?

I don’t use Blackboards or Behaivour Trees, or does this not matter?

Right - my bad. It may be that you could hack a parse if you had a blackboard component and used the function, but otherwise I don’t think it’s plausible to do in blueprints.

If you feel that this has answered your question, please mark the question as answered.Thanks! =)

Ok, do you have any idea, how to do this in C++ or do you know a good tutorial, which include things like these?

thanks. :slight_smile:

Do you have so good answers, on my other questions, which nobody answers?

This is how I did it, but it requires a new function for each enum.

5 Likes

This is my solution. It’s a bit clumsy, but it gets the job done, allowing you to reference thereafter and use Enum-based switches. I’m just going to change it around a bit to tell me if it can’t find one of the enum entries to match the name.

Bit late to the party, but this works for me.

2 Likes

Just in case someone was struggling as hard as me. Here’s the code that will allow you to set your Enum variables using a String input. Don’t know how useful this can be, but there you go.

My main method to set any prop from a given string and prop name, the Enum portion highlighted at the bottom

The actual code to set the Enum as Byte