- Home /
Another Error - Enum.Parse
static var saved90left = "KeyCode.Q";
static var t90l : KeyCode = KeyCode.Q;
function Start () {
t90l = System.Enum.Parse( typeof( t90l ), saved90left );
}
when i do this i get this message
ArgumentException: The requested value 'KeyCode.Q' was not found. System.Enum.Parse (System.Type enumType, System.String value, Boolean ignoreCase) System.Enum.Parse (System.Type enumType, System.String value) Mouse2.Start () (at Assets/Scripts/Mouse2.js:13)
can someone explain this?
Comment
Best Answer
Answer by Chesley · Oct 05, 2011 at 02:25 PM
you basicity need to use "Q" as a string instead of the "KeyCode.Q".
while parsing the string to a keycode, KeyCode. will be automatically added
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Convert String into KeyCode (UnityScript) 0 Answers
Another KeyCode problem... 2 Answers
Mecanim Tutorial Problem 2 Answers
Joystick won't move in Unity 0 Answers