Hi everyone,
there are a lot of questions (and answers) about getting a variable by name but is there a possibility to get the variable name as a string instead of its value? Basically a BP (or C++ but that I find unlikely) version of C#'s nameof() where a nameof(VARIABLE) is replaced by the actual name at compile time.
Of course it would be no problem to just enter the name by hand but just for convenience sake I wanted to ask.
Currently I am using the reflection system to dynamically bind UMG elements to variables of some object. Right now I am typing in the name of each variable by hand to find it on the C++ side which works fine. I was just asking myself of such a funtionality exists because then it would be less work when it comes to variable renaming. Thanks for your answer though.
This would be super useful for material parameters too - often i’ll use a BP to randomise some values then apply that to a material instance in the BP - typing out 10-30 material parameter names is super tedious when they’re exactly the same as the variable names…
Same this would be a handy node to for UMG, say you have a structure of sever settings you grab the variable name and value and set it to display in UMG.
I really expected this to be a macro function since in C++ precompiler macros you can just do #VARIABLE to get a string literal of the refferenced variable’s identifier. This would also be very useful for debugging.