Use Input.Getkey(KeyCode.) with a char/string as the input?

I’m trying to use Input.GetKey(KeyCode.?) and put in a variable after KeyCode.
For instance, if I declare a string “ForwardInput” equals “W”, I want it to accept Input.GetKey(KeyCode.ForwardInput) as an acceptable input.
I also want to be able to set ForwardInput to anything asides from W, such as let it be M for example.

Make a class called something like “CustomInput” and give it any methods you need from Input, but with you’ll be able to give yourself more control and flexibility. You can make an enum with all the custom names you want and put them in a dictionary where they are the key and the value is the proper button you want pressed for that name. Then create your own GetKeyDown method and use that enum as the variable.

Personally, I just use Rewired Input Manager (an asset store plugin), because it’s super versatile and already has everything you want.

You can use InputManager to map your keys.