Пример #1
0
    /// <summary>
    /// 协程异步加载场景
    /// </summary>
    /// <param name="name"></param>
    /// <param name="action"></param>
    /// <returns></returns>
    IEnumerator ReallyLoadSceneAsyn(string name, UnityAction action)
    {
        AsyncOperation ao = SceneManager.LoadSceneAsync(name);

        //得到场景进度
        while (!ao.isDone)
        {
            EventCenter.getInst().EventTrigger("SceneLoadProgress", ao.progress);

            yield return(ao.progress);
        }

        //加载完执行action
        action();
    }