public Rigidbody2D rb;
public float maxSpeed;
private void Start()
{
rb = GetComponent<Rigidbody2D>();
}
void Update()
{
float move = Input.GetAxis("Horizontal");
rb.velocity = new Vector2(move * maxSpeed, rb.velocity.y);
}