Is there a way to turn a saved string in player prefs back into a keycode. (Or is there a better way of saving key preferences?) e.g.
upKey = PlayerPrefs.GetString("upKey", KeyCode.UpArrow.ToString());
// This results in Assets/Scripts/Game/PlayerSettings.js(15,48): BCE0022: Cannot convert 'String' to 'UnityEngine.KeyCode'.
x4000
3
You can use string representations of enums just fine. All you have to do is this to parse it back to an enum (in C#):
KeyCode keycodeResult = (KeyCode)Enum.Parse( typeof(KeyCode), yourString );
Loius
2
KeyCode is an enum, so you need to use ints -
upKey = PlayerPrefs.GetInt("upKey", parseInt( KeyCode.UpArrow ) );