private void ProcessUnloadRequests() { var goCount = _cachedUnloadGoRequest.Count; var sceneCount = _cachedUnloadSceneRequest.Count; for (int i = 0; i < goCount; i++) { var go = _cachedUnloadGoRequest.Dequeue(); if (BeforeGoUnloaded != null) { BeforeGoUnloaded(go); } if (GoUnloaded != null) { GoUnloaded.Invoke(go); } _assetManager.Recycle(go); --NotFinishedRequests; } for (int i = 0; i < sceneCount; i++) { var scene = _cachedUnloadSceneRequest.Dequeue(); SceneManager.UnloadSceneAsync(scene); _logger.InfoFormat("unload scene {0}", scene); } }
private void ProcessUnloadRequests() { var goCount = _cachedUnloadGoRequest.Count; var sceneCount = _cachedUnloadSceneRequest.Count; for (int i = 0; i < goCount; i++) { var go = _cachedUnloadGoRequest.Dequeue(); if (BeforeGoUnloaded != null) { BeforeGoUnloaded(go); } RemoveRequest(LevelRequestEnum.UnloadGo, go.Address.ToString()); if (GoUnloaded != null) { GoUnloaded.Invoke(go); } if (!SharedConfig.DisableRecycleSetramingGo) { _assetManager.Recycle(go); } else { UnityEngine.Object.Destroy(go); } --NotFinishedRequests; } for (int i = 0; i < sceneCount; i++) { var scene = _cachedUnloadSceneRequest.Dequeue(); SceneManager.UnloadSceneAsync(scene); _logger.InfoFormat("unload scene {0}", scene); } }