using System.Collections; using System.Collections.Generic; using UnityEngine; public class BoxController : MonoBehaviour { private float speed = 10f; Rigidbody2D rb; // Start is called before the first frame update void Start() { rb = GetComponent<Rigidbody2D>(); } // Update is called once per frame void Update() { float move = Input.GetAxis("Horizontal"); rb.velocity = new Vector2(move * speed, rb.velocity.y); } // void Update() }