Exemple #1
0
    public void ReloadCurrentSceneAsynchronously()
    {
        int index = SceneManager.GetActiveScene().buildIndex;

        if (index != -1)
        {
            Time.timeScale      = 1f;
            Time.fixedDeltaTime = 0.02f;
            int asyncSceneIndex = SceneUtility.GetBuildIndexByScenePath(ASYNCLOADER_SCENE_NAME);
            AsyncLoadIndexSaver.SetIndexToPreload(index);
            StartCoroutine(SharedUtilities.GetInstance().StartSceneWithDelay(0, asyncSceneIndex));
            SceneChanged?.Invoke(SceneManager.GetActiveScene().name);
        }
    }
Exemple #2
0
 private void Start()
 {
     indexToPreload = AsyncLoadIndexSaver.GetSceneIndexToPreload();
     StartCoroutine(LoadSceneAsync());
 }