godot print enum name
To print the name of an enum in GDScript, you can use the str()
function along with the enum value. Here's an example:
enum MyEnum {
VALUE_A,
VALUE_B,
VALUE_C
}
var myEnumValue = MyEnum.VALUE_B
print(str(myEnumValue))
In this example, str(myEnumValue)
converts the enum value VALUE_B
to its string representation, which is then printed using the print()
function. The output will be "VALUE_B"
.
You can replace MyEnum
with the name of your enum, and VALUE_B
with the specific enum value you want to print.