//get the starting position on the map public void getStartPos() { gs = GameObject.FindGameObjectWithTag("SceneController").GetComponent <gridScript>(); u = GameObject.FindGameObjectWithTag("SceneController").GetComponent <uitl>(); while (!getRandomPos()) { ; } prevPos = pos; }