private float SPEED = 0.01f; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { Vector2 position = transform.position; if (Input.GetKey(KeyCode.RightArrow)) { Debug.Log(position); position.x += SPEED; } if (Input.GetKey(KeyCode.LeftArrow)) { position.x -= SPEED; } transform.position = position; }