Exemplo n.º 1
0
        private void ProcessFinishedOperation(AssetBundleLoadOperation operation)
        {
            AssetBundleDownloadOperation download = operation as AssetBundleDownloadOperation;

            if (download == null)
            {
                return;
            }

            if (download.Error == null)
            {
                loadedAssetBundles.Add(download.AssetBundleName, download.AssetBundle);
            }
            else
            {
                string msg = string.Format("Failed downloading bundle {0} from {1}: {2}", download.AssetBundleName, download.GetSourceURL(), download.Error);
                downloadingErrors.Add(download.AssetBundleName, msg);
            }

            downloadingBundles.Remove(download.AssetBundleName);
        }
Exemplo n.º 2
0
        // Starts a load operation for a level from the given asset bundle.
        public static AssetBundleLoadOperation LoadLevelAsync(string assetBundleName, string levelName, bool isAdditive)
        {
            Log(LogType.Info, "Loading " + levelName + " from " + assetBundleName + " bundle");

            AssetBundleLoadOperation operation = null;

            #if UNITY_EDITOR
            if (SimulateAssetBundleInEditor)
            {
                operation = new AssetBundleLoadLevelSimulationOperation(assetBundleName, levelName, isAdditive);
            }
            else
            #endif
            {
                assetBundleName = RemapVariantName(assetBundleName);
                LoadAssetBundle(assetBundleName);
                operation = new AssetBundleLoadLevelOperation(assetBundleName, levelName, isAdditive);

                inProgressOperations.Add(operation);
            }

            return(operation);
        }