using System.Collections; using System.Collections.Generic; using UnityEngine; public class test : MonoBehaviour { // Start is called before the first frame update bool shouldmove = false; public void startmove(){ shouldmove = true; } // Update is called once per frame void Update() { if(shouldmove && transform.position.y <= 2){ transform.position += new Vector3(0f, 0.02f, 0f); } } }