Beispiel #1
0
    private IEnumerator IE_LoadingFadeAsync(string levelName, float delay, bool autoFadeIn = true)
    {
        yield return(new WaitForSeconds(delay));

        FadeScene.FadeOut( );
        yield return(new WaitForSeconds(0.3f));

        Deallocate( );
        yield return(SceneManager.LoadSceneAsync("Loading"));

        FadeScene.FadeIn( );
        yield return(new WaitForSeconds(1f));

        FadeScene.FadeOut( );
        yield return(new WaitForSeconds(0.3f));

        yield return(SceneManager.LoadSceneAsync(levelName));

        if (autoFadeIn)
        {
            FadeScene.FadeIn( );
        }
        Resources.UnloadUnusedAssets( );
        System.GC.Collect( );
    }
Beispiel #2
0
    private IEnumerator IE_LoadingStreamFadeAsync(string levelName, float waitTime)
    {
        string url = m_URL + levelName + ".unity3d";

        m_Stream = new WWW(url);
        yield return(new WaitForSeconds(waitTime));

        FadeScene.FadeOut( );
        yield return(new WaitForSeconds(0.3f));

        Deallocate( );
        yield return(SceneManager.LoadSceneAsync("Loading"));

        FadeScene.FadeIn( );
        yield return(m_Stream);

        if (string.IsNullOrEmpty(m_Stream.error))
        {
            AssetBundle bundle = m_Stream.assetBundle;
            FadeScene.FadeOut( );
            yield return(SceneManager.LoadSceneAsync(levelName));

            FadeScene.FadeIn( );
            bundle.Unload(false);
        }
        else
        {
            Debug.LogError(m_Stream.error);
        }
        m_Stream.Dispose( );
    }
Beispiel #3
0
    private IEnumerator IE_FadeAsync(string levelName, float delay)
    {
        yield return(new WaitForSeconds(delay));

        FadeScene.FadeOut( );
        yield return(new WaitForSeconds(0.3f));

        Deallocate( );
        yield return(SceneManager.LoadSceneAsync(levelName));

        FadeScene.FadeIn( );
    }