I’m looking to create the simplest way of assigning custom inputs at runtime. My first idea for this was to declare a keycode variable, assign it via a string and call it with getkey. Except you can’t assign a string with to a keycode. Does Unity have a function similar To ToString() except with keyCodes? If it doesn’t I have some pseudocode of how it might work. I could use some help fleshing the pseudocode out as I don’t think that’s how ToString() functions.
Public Keycode myKeyCode;
void Update(){
if (Input.GetKey(myKeyCode)){
//Execute Something
}
}
Public [] KeyCode keyCodes;
public [] String keyCodeStrings;
void ToKeyCode(KeyCode k, String s,){
for (int i = 0; i < keyCodeStrings.Length; i++){
if(s = keyCodeStrings[i]){
k = keyCodes[i];
}
}
}