Download

How to pass enum description into strings?

Hi,

I have an enum that stores values and descriptions. The values are tied to the stats of the player and the description is there as flavour text for those levels. I’m trying to pass the description values into a widget, but I’m having trouble getting that working. Any advice?

I’ve attached a screenshot of the enum and would love to see how I could pass the Description values into the widget using blueprints.

Thanks!

Can you just ‘to string’ them?

Screenshot_5.jpg

I think he’s trying to treat it like a TArray/TMap. Index -> description value

So on Index 1 he wants a return of Wet Noodle.

That’s correct, exactly what I’m looking to do!
And she/her, if you please.

My bad.
Anyway, not possible directly. Enums are value lists. To do what you want you need to use an array. Key -> Value.

String (Array) (None, Wet Noodle, etc, etc, etc)
[0] = None
[1] = Wet Noodle
[2] = Beached Jellyfish
etc.

Other option is a TMap (Int, String)

Good point, Rev0verDrive. Since I’m using blueprints I’ll switch over to an array. This is going to be a little ugly (since the values tie to levels and those run 1-10), but it’ll still work just fine.

Thanks for the help!