cant acces built in enums using strings?

Godot Version

4.6.1.stable

Question

cant seem to be able to select from built in enums using strings..

this works:

test["something"]

but this doesn’t:

Input.MouseMode["MOUSE_MODE_CONFINED"]

also cant do things like:

Input.MouseMode.keys()
Input.MouseMode.values()
Input.MouseMode.size()

but i can if i make my own enum?

why is this? is there a better way to do the same? is there a workaround?

Thanks for the help ^^

Your custom enums behave like Dictionaries.

The built-in enums aren’t Dictionaries, but just baked constants, so you can’t do the same operations as you would with a Dictionary.

Why do you even need it? I’ve never seen a use case before where it would be required to access the built in enums like that.

1 Like

okay.
im trying to make a settings file using the raw text key instead of the value to make it a little more human readable

2 Likes

OK, understood, and fairly reasonable.

You can play around with this then:

1 Like