Example #1
0
        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;
        }
Example #2
0
        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);
        }
Example #3
0
        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();
            }
        }
Example #4
0
 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]);
     }
 }
Example #5
0
        private void Awake()
        {
            DontDestroyOnLoad(gameObject);

            FinalPatchData data = Resources.Load <FinalPatchData>("FinalPatchData");

            FinalPool.Init(data);
            FinalLoader.Init(data);
            FinalPatcher.Init(data, deployDataUrl, channel);
        }
Example #6
0
        public async Task UnloadSceneAsync(string sceneName)
        {
            AssetCache cache;

            if (!FinalLoader.AssetNameCaches.TryGetValue(sceneName, out cache))
            {
                return;
            }

            await SceneManager.UnloadSceneAsync(sceneName);

            FinalLoader.UnloadAsset(cache);
        }
Example #7
0
        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);
        }
Example #8
0
 private async void UnloadScene()
 {
     await FinalLoader.UnloadSceneAsync("Assets/BBGo/FinalPatch/Demo/Bundles/BundleScene.unity");
 }
Example #9
0
 private async void LoadScene()
 {
     await FinalLoader.LoadSceneAsync("Assets/BBGo/FinalPatch/Demo/Bundles/BundleScene.unity", LoadSceneMode.Additive);
 }