Ejemplo n.º 1
0
        public void Run()
        {
            //存在していれば前回のマニフェストのキャッシュを取得
            m_Cache = LoadCache();

            //今回ビルドするターゲット一覧を取得
            var builds = TargetProvider.GetBuildTargets(m_Cache);

            //通常のバンドルビルド
            if (!Directory.Exists(m_Setting.OutputPath))
            {
                Directory.CreateDirectory(m_Setting.OutputPath);
            }
            m_Current = BuildPipeline.BuildAssetBundles(m_Setting.OutputPath, builds, m_Setting.Options, m_Setting.BuildTarget);

            //ビルド時にコンパイルが走りアセットがアンロードされるので再ロードする必要がある
            m_Cache = LoadCache();

            //一度、先ほどビルドしたマニフェストを退避させる
            var    dirName            = Path.GetFileName(m_Setting.OutputPath);
            string manifestBundlePath = Path.Combine(m_Setting.OutputPath, dirName);

            using (new StashFileScope(new string[] { manifestBundlePath, manifestBundlePath + ".manifest" }))
            {
                //拡張マニフェストをビルドする
                BuildManifest(builds);
            }
            //スコープを終えたので退避したマニフェストが戻る
        }
Ejemplo n.º 2
0
        public AssetBundleBuild[] GetBuildTargets(ExManifestAsset cache)
        {
            AssetDatabase.RemoveUnusedAssetBundleNames();
            var names = AssetDatabase.GetAllAssetBundleNames();

            AssetBundleBuild[] builds = new AssetBundleBuild[names.Length];
            for (int i = 0; i < names.Length; i++)
            {
                string name  = names[i];
                var    build = new AssetBundleBuild();
                build.assetBundleName = name;
                build.assetNames      = AssetDatabase.GetAssetPathsFromAssetBundle(name);
                builds[i]             = build;
            }
            return(builds);
        }
Ejemplo n.º 3
0
        public ExManifest(ExManifestAsset manifestAsset)
        {
            m_Infos = manifestAsset.Infos;
            m_Dic   = new Dictionary <string, ABInfo>(m_Infos.Length);
            foreach (var d in m_Infos)
            {
                m_Dic[d.Name] = d;
            }

            m_DepInfo = manifestAsset.DepInfo;
            m_TagInfo = manifestAsset.TagInfo;

            var reference = manifestAsset.RefInfo;

            m_Ref = new Dictionary <string, RefInfo>(reference.Length);
            foreach (var r in reference)
            {
                m_Ref[r.Id] = r;
            }
        }