void Start() { StartCoroutine(AutoRun()); } //隔一段时间运行 IEnumerator AutoRun() { while (true) { //执行程序 yield return new WaitForSeconds(10); } }