Im working a long time with Unity and i never have seen THIS error and i cant get rid of it no matter what i do...
UnityException: Input Key named: KeyCode.E is unknown UnityEngine.Input.GetKeyDown (string)
(wrapper dynamic-method) UnityEngine.Input.Input$GetKeyDown$System.String (object,object)
Mouse.Update () (at Assets/Scripts/Mouse.js:9)
basically im getting the "KeyCode.E" from another script so its like Input.GetKey(GameObject.Find(CONTROLS).GetComponent(CONTROLS).forward)
Answer by aldonaletto
Oct 01, 2011 at 06:33 PM
Could GetKey had choosed the wrong version (overload method)? There are two versions, one that accepts strings, and another that expects a KeyCode value. Maybe somewhere in the process the wrong version is choosen, and it causes the error. Try to assign the code to an intermediate variable, like this:
var fwdCode: KeyCode = GameObject.Find(CONTROLS).GetComponent(CONTROLS).forward;
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users post good questions and use the site effectively we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
3 People are following this question.
A node in a childnode?
C# Script error (error CS8025: Parsing error)
error CS0019: Operator `>' cannot be applied to operands of type `UnityEngine.Vector3' and `int'
Need help syntax error
Simple Script getting Errors.