void Start() { StartCoroutine("coRoutineTest", 1f); } IEnumerator coRoutineTest (float waitTIme) { while (true) { buoyancy.surfaceLevel = Random.Range(4f, 2f); yield return new WaitForSeconds(waitTIme); } }