各位前辈,小弟我在练习开发android上的游戏
我在电脑上执行
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex) ;
可以成功的重新开始这个scene
但是当我输出成APK到手机上执行时
敌人就没有办法顺利生成
我敌人生成的方式是在start()内呼叫 StartCoroutine (SpawnWaves ());
IEnumerator SpawnWaves (){
yield return new WaitForSeconds (startWait);
while(true){
for (int i = 0; i < hazardCount; ++i){
Vector3 spawnPosition =
new Vector3 (Random.Range (xMin, xMax), yMax, 0);
//我有测试在这边将xMin,xMax,yMax,hazard,hazardCount,i,Time.time显示在萤幕上
//在还没有重新执行时i都顺利增加,Time.time也会跑,可是当我重新开始时i跟时间
//就只会卡在一个值了
Instantiate (hazard, spawnPosition, transform.rotation);
yield return new WaitForSeconds (spawnWait);
}
yield return new WaitForSeconds (waveWait);
if (gameOver) {
restartText.text = "Double click to Restart";
restart = true;
break;
}
}
}
想请教各位前辈可以帮我提点一下吗,谢谢