internal void DestroyPool() { if (m_reference.Count > 0) { GameObject[] objects = new GameObject[m_reference.Count]; int i = 0; foreach (var obj in m_reference) { objects[i++] = obj; } foreach (var obj in objects) { ReleaseObject(obj); } } foreach (var free in m_free) { Object.Destroy(free); } m_free.Clear(); FinalLoader.UnloadAsset(m_asset); m_asset = null; }
private static async Task <GameObjectPool> GetOrCreateGameObjectPoolAsync(string assetName) { GameObjectPool pool; try { await s_getOrCreateGameObjectPoolSemaphore.WaitAsync(); if (!Pools.TryGetValue(assetName, out pool)) { GameObject asset = await FinalLoader.LoadAssetAsync <GameObject>(assetName); if (asset != null) { pool = new GameObjectPool(asset, assetName, s_data.poolMaxCache, s_data.poolEnableAutoRelease, s_data.poolAutoReleaseDuration); Pools.Add(assetName, pool); } } } finally { s_getOrCreateGameObjectPoolSemaphore.Release(); } return(pool); }
private void Update() { if (Input.GetKeyDown(KeyCode.Q)) { LoadBundle(); } if (Input.GetKeyDown(KeyCode.W)) { UnloadBundle(); } if (Input.GetKeyDown(KeyCode.Z)) { FinalPool.Reset(); FinalLoader.Reset(); FinalPatcher.Reset(); FinalPatcher.AutoPatch(); } if (Input.GetKeyDown(KeyCode.A)) { LoadScene(); } if (Input.GetKeyDown(KeyCode.S)) { UnloadScene(); } }
private async Task LoadDependenciesAsync(string assetName) { string[] dps = GetManifest().GetDirectDependencies(assetName); for (int i = 0; i < dps.Length; i++) { await FinalLoader.LoadAssetAsync <Object>(dps[i]); } }
private void Awake() { DontDestroyOnLoad(gameObject); FinalPatchData data = Resources.Load <FinalPatchData>("FinalPatchData"); FinalPool.Init(data); FinalLoader.Init(data); FinalPatcher.Init(data, deployDataUrl, channel); }
public async Task UnloadSceneAsync(string sceneName) { AssetCache cache; if (!FinalLoader.AssetNameCaches.TryGetValue(sceneName, out cache)) { return; } await SceneManager.UnloadSceneAsync(sceneName); FinalLoader.UnloadAsset(cache); }
public async Task UnloadSceneAsync(string sceneName) { AssetCache cache; if (!FinalLoader.AssetNameCaches.TryGetValue(GetPathConverter().GetAssetBundleName(sceneName), out cache)) { return; } await SceneManager.UnloadSceneAsync(sceneName); FinalLoader.UnloadAsset(cache); }
private async void UnloadScene() { await FinalLoader.UnloadSceneAsync("Assets/BBGo/FinalPatch/Demo/Bundles/BundleScene.unity"); }
private async void LoadScene() { await FinalLoader.LoadSceneAsync("Assets/BBGo/FinalPatch/Demo/Bundles/BundleScene.unity", LoadSceneMode.Additive); }