I'm making an endless runner game, and I have stuck on a problem. I need my charater to move left to right, but it wont do it.
I need it to move smooth from left to right and not in lanes. Since my game will be having random object popping up all over the trail.

I have assigened the left and right key to A and D in Unity.

Is it my code?

```
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Ballmove : MonoBehaviour {

public KeyCode moveL;
public KeyCode moveR;

public float horizVel = -4;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    GetComponent<Rigidbody>().velocity = new Vector3(-4, 0, 0);

    if (Input.GetKeyDown(moveL))
    {
        horizVel = -5;
        StartCoroutine(stopSlid());
    }
    if (Input.GetKeyDown(moveR))
    {
        horizVel = 5;
        StartCoroutine(stopSlid());
    }
}
IEnumerator stopSlid()
{
    yield return new WaitForSeconds(1);
    horizVel = -4;
}
}

```