定时 场景转换
部分说明
Invoke设置从开始到场景转换所用总共时常。
IEnumerator 从开始便加载场景。
定时时常:Invoke(“LS”,10F);
代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class chanjingzhuanhuan : MonoBehaviour {
public string nextSceneName = "psdc";
private AsyncOperation async = null;
// Use this for initialization
void Start () {
StartCoroutine("LoadScene");
Invoke("LS",10F);
}
IEnumerator LoadScene() {
async = SceneManager.LoadSceneAsync(nextSceneName);
async.allowSceneActivation = false;
yield return null;
}
void LS()
{
async.allowSceneActivation = true;
}
}