public class movement : MonoBehaviour
{
private Rigidbody2D rb;
public float speed;
float move;
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
void FixedUpdate()
{
move = Input.GetAxis("Horizontal");
rb.AddForce(move * speed, rb.velocity.y);
}
}