So I came across an issue with my movement for my character in this game. The left control works perfectly but when use the right arrow key nothing happens. When i remove the code for the left key the right key works. When i place the left key code above the right key code neither of them work. Here is the code.` public float speed = 8f;
public float upSpeed = 5f;
public Rigidbody2D player;
// Use this for initialization
void Start () {
player = GetComponent<Rigidbody2D> ();
}
// Update is called once per frame
void Update () {
if (Input.GetKey (KeyCode.RightArrow)) {
player.velocity = new Vector2 (speed, 0);
}
else {
Input.GetKeyUp(KeyCode.RightArrow);
player.velocity = new Vector2(0, 0);
}
if (Input.GetKey (KeyCode.LeftArrow)) {
player.velocity = new Vector2 (-speed , 0);
}
else {
Input.GetKeyUp(KeyCode.LeftArrow);
player.velocity = new Vector2(0, 0);
}
float upMove = Time.deltaTime * 5;
transform.Translate(0, upMove, 0, Space.World);
}