예제 #1
0
        private IEnumerator PreInitialize(string relativePath)
        {
            var platformName = AssetBundleDef.GetPlatformName();

            m_downloadingURL = string.Format("{0}/{1}/", relativePath, platformName);
            TEDDebug.LogFormat("[AssetBundleSystem] - The AssetBundle download url is {0}", m_downloadingURL);

            yield return(StartCoroutine(InitializeCatalog()));

            if (m_assetBundleCatalogs == null)
            {
                if (m_onInitializeFinish != null)
                {
                    m_onInitializeFinish(false);
                    m_onInitializeFinish = null;
                    yield break;
                }
            }

            var request = InitializeManifest(platformName);

            if (request != null)
            {
                yield return(StartCoroutine(request));
            }
        }
예제 #2
0
        public static void Build(AssetBundleBuildInfo buildInfo)
        {
            AssetBundleNameBuilder.Build();

            AssetDatabase.Refresh();
            AssetDatabase.RemoveUnusedAssetBundleNames();

            if (buildInfo.CleanFolders)
            {
                if (Directory.Exists(buildInfo.OutputPath))
                {
                    Directory.Delete(buildInfo.OutputPath, true);
                }
            }

            if (!Directory.Exists(buildInfo.OutputPath))
            {
                Directory.CreateDirectory(buildInfo.OutputPath);
            }

            if (buildInfo.SpecificAssetBundles == null || buildInfo.SpecificAssetBundles.Length == 0)
            {
                BuildPipeline.BuildAssetBundles(buildInfo.OutputPath, buildInfo.BuildOptions, buildInfo.Target);
            }
            else
            {
                BuildPipeline.BuildAssetBundles(buildInfo.OutputPath, buildInfo.SpecificAssetBundles, buildInfo.BuildOptions, buildInfo.Target);
            }

            AssetBundleCatalogBuilder.Build(buildInfo.OutputPath);

            if (buildInfo.CopyToStreamingAssets)
            {
                var streamingAssetsPath = Path.Combine(STREAMING_ASSETS_FOLDER_PATH, AssetBundleDef.ASSET_BUNDLE_OUTPUT_FOLDER);
                streamingAssetsPath = Path.Combine(streamingAssetsPath, AssetBundleDef.GetPlatformName());

                if (Directory.Exists(streamingAssetsPath))
                {
                    Directory.Delete(streamingAssetsPath, true);
                }

                DirectoryCopy(buildInfo.OutputPath, streamingAssetsPath);
            }

            AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);

            TEDDebug.Log("Build AssetBundles successfully.");
        }
예제 #3
0
        private AssetBundleLoadManifestRequest InitializeManifest(string path)
        {
            UnloadAssetBundles(new List <string> {
                AssetBundleDef.GetPlatformName()
            });

            TEDDebug.LogFormat("[AssetBundleSystem] - Start download AssetBundleManifest at frame {0}", Time.frameCount);

            DownloadAssetBundle(path, true);

            var request = new AssetBundleLoadManifestRequest(path, "AssetBundleManifest");

            m_inProgressRequests.Add(request);

            return(request);
        }