- Home /
Errors are appearing but i don't know how to fix these...
Im getting 3 errors from this script
void Update () { playerVelocity.x = Input.GetAxis("Horizontal") * WalkingSpeed;
if(Input.GetKeyDown(KeyCode.right))
{
playerVelocity.y = JumpingSpeed;
}
else
{
playerVelocity.y = rigidbody.velocity.y;
}
Here are the three errors
Assets/Scripts/PlayerScripts/PlayerController2D.cs(27,39): error CS0117: `UnityEngine.KeyCode' does not contain a definition for `right'
Assets/Scripts/PlayerScripts/PlayerController2D.cs(27,20): error CS1502: The best overloaded method match for
UnityEngine.Input.GetKeyDown(string)' has some invalid arguments Assets/Scripts/PlayerScripts/PlayerController2D.cs(27,20): error CS1503: Argument
#1' cannot convert object' expression to type
string'
Any help is appreciated and merry christmas
Answer by efge · Dec 17, 2010 at 10:01 PM
Did you mean KeyCode.RightArrow?
just remember that you hardcode your keyinput this way. Rather use Input.GetButton("right")
http://unity3d.com/support/documentation/ScriptReference/Input.GetButton.html
Your answer
Follow this Question
Related Questions
cannot destroy transform 1 Answer
Asset Bundle export script 'Cannot convert' error 1 Answer
Error CS1525 calling OntriggerEnter 1 Answer