good day, trying to move an object x by 1 but when I press the arrow the object moves and returns to its place
public class rotation : MonoBehaviour { private Vector3 MousePos; private float myAngle = 0f; public float sensitivity = 1F; // Update is called once per frame void Update() { MousePos = Input.mousePosition; Camera main = GetComponent<Camera>(); Vector3 vector = new Vector3(1, 1, 1); if (Input.GetKeyDown(KeyCode.LeftArrow)) { float x = vector.x; float y = vector.y; float z = vector.z; x--; main.transform.position = new Vector3(x, y, z); } else { main.transform.position = vector; } } // Use this for initialization public GameObject go; private Camera goCamera; void Start() { goCamera = GetComponent<Camera>(); }