Example #1
0
 public void Win()
 {
     Debug.Log("WIN");
     currentLevel++;
     if (currentLevel < levels.Length)
     {
         //Addressables.LoadAssetAsync<Scene>(levels[currentLevel]).Completed += OnLoadDone;
         Addressables.LoadScene(levels[currentLevel], LoadSceneMode.Single);
     }
 }
 public void LoadAddressableScene(string address, LoadSceneMode mode, OnSceneChangedAction callback)
 {
     Addressables.LoadScene(address, mode).Completed += (opr) =>
     {
         if (callback != null)
         {
             callback();
         }
     };
 }
Example #3
0
    void DownloadCompleted(bool success, string message)
    {
        if (!success)
        {
            Debug.Log("Download failed: " + message);
            return;
        }

        Debug.Log("Download succeeded!");

        Addressables.LoadScene("Scenes/Many Trees Scene.unity");
    }
        /// <summary>
        /// Loads a given scene either in additive or single mode to the current scene.
        /// </summary>
        /// <param name="sceneName">Name of the scene to load.</param>
        /// <param name="loadMode">Scene load mode.</param>
        public Task <Scene> LoadScene(string sceneName, LoadSceneMode loadMode)
        {
            _currentlyLoadingScene      = default;
            _currentlyLoadingScene.name = "";

            Addressables.LoadScene(sceneName, loadMode).Completed += AddressablesManager_OnSceneLoadCompleted;

            if (string.IsNullOrEmpty(_currentlyLoadingScene.name))
            {
                Task.Delay(1);
            }

            return(Task.Run(() => _currentlyLoadingScene));
        }
Example #5
0
        public void LoadScene(SceneLookupEnum key, LoadSceneMode loadSceneMode)
        {
            var scene = Addressables.LoadScene(SceneLookup.GetString(key), loadSceneMode);

            scene.Completed += (result) =>
            {
                if (result.Status == AsyncOperationStatus.Succeeded)
                {
                    m_scene.Add(key, result.Result);
                }
                else
                {
                    Debug.LogError($"场景======{key} 加载失败!!!");
                }
            };
        }
Example #6
0
 void OnButtonClick()
 {
     if (string.IsNullOrEmpty(addressToAdd))
     {
         Debug.LogError("Address To Add not set.");
     }
     else
     {
         if (m_ReadyToLoad)
         {
             Addressables.LoadScene(addressToAdd, LoadSceneMode.Additive).Completed += OnSceneLoaded;
         }
         else
         {
             Addressables.UnloadScene(m_LoadedScene).Completed += OnSceneUnloaded;
         }
     }
 }
Example #7
0
 void OnButtonClick()
 {
     Addressables.LoadScene(NextSceneAddress);
 }
Example #8
0
 public void LoadScene(SceneLookupEnum key, LoadSceneMode loadSceneMode)
 {
     Addressables.LoadScene(SceneLookup.GetString(key), loadSceneMode);
     SceneManager.Instance().SetCurrentScene(key);
 }
 /// <summary>
 /// Loads a given scene either in additive or single mode to the current scene.
 /// </summary>
 /// <param name="sceneName">Name of the scene to load.</param>
 /// <param name="loadMode">Scene load mode.</param>
 public async Task OnlyLoadScene(string sceneName, LoadSceneMode loadMode)
 {
     await Task.Run(() => Addressables.LoadScene(sceneName, loadMode));
 }
 public void LoadAssetSceneButtonTest(int i) // Just a test method
 {
     Addressables.LoadScene((i == 0) ? sceneAsset1 : sceneAsset2);
 }