using UnityEngine;
using System.Collections;
public class PlayerMovement : MonoBehaviour {
public float speed;
void Update () {
Move();
}
void Move() {
if (Input.GetKey (KeyCode.D) || Input.GetKey (KeyCode.RightArrow)) {
transform.Translate (Vector2.right * speed * Time.deltaTime);
} else if (Input.GetKey (KeyCode.A || Input.GetKey (KeyCode.LeftArrow)) {
transform.Translate (Vector2.left * speed * Time.deltaTime);
} [B]else if [/B](Input.GetKey (KeyCode.W) || Input.GetKey (KeyCode.UpArrow)) { //This else if here has a red underline in the editor
Jump();
}
}
void Jump() {
}
}
This is the error:
![]()
The bolded part has a red underline in MonoDevelop and I can’t figure out why. As far as I can tell, all of the braces are pairs…
Also, the Input.GetKey (KeyCode.LeftArrow) doesn’t let my character move left with the left, but it allows A to be used. Any help would be appreciated.