Esempio n. 1
0
    private IEnumerator LoadScene_Routine(string inNextScene, SequenceBuilder inSequence)
    {
        var asyncOp = Application.LoadLevelAsync(LOADING_SCENE_NAME);

        while (!asyncOp.isDone)
        {
            yield return(null);
        }

        GC.Collect();
        yield return(1.0f);

        asyncOp = Resources.UnloadUnusedAssets();
        while (!asyncOp.isDone)
        {
            yield return(null);
        }

        yield return(null);

        if (inSequence != null)
        {
            yield return(inSequence.Run());
        }

        asyncOp = Application.LoadLevelAsync(inNextScene);
        while (!asyncOp.isDone)
        {
            yield return(null);
        }
    }