private void Setup()
        {
            if (string.IsNullOrEmpty(Prefs.externalResourcesPath) || string.IsNullOrEmpty(Prefs.assetManageConfigGUID))
            {
                return;
            }

            var externalResourcesPath = Prefs.externalResourcesPath;
            var assetManageConfigPath = AssetDatabase.GUIDToAssetPath(Prefs.assetManageConfigGUID);
            var assetManageConfig     = AssetDatabase.LoadMainAssetAtPath(assetManageConfigPath) as AssetManageConfig;

            AssetManageConfig.OnReloadAsObservable().Subscribe(_ => Setup()).AddTo(Disposable);

            assetManageManager = new AssetManageManager();
            assetManageManager.Initialize(externalResourcesPath, assetManageConfig);

            if (!string.IsNullOrEmpty(Prefs.selectionAssetGUID))
            {
                var assetPath = AssetDatabase.GUIDToAssetPath(Prefs.selectionAssetGUID);
                selectionAssetObject = AssetDatabase.LoadMainAssetAtPath(assetPath);

                UpdateViewInfo(selectionAssetObject);
            }

            initialized = true;

            Repaint();
        }
示例#2
0
        //----- method -----

        public void Initialize(string externalResourcesPath, AssetManageConfig config)
        {
            this.externalResourcesPath = externalResourcesPath;
            this.config = config;

            groupInfos  = new List <GroupInfo>(config.GroupInfos);
            manageInfos = new List <ManageInfo>(config.ManageInfos);

            assetCollectInfoByAssetPath = new Dictionary <string, AssetCollectInfo>();

            manageInfoSearchCache = null;
        }
        public void Initialize(string externalResourcesPath, AssetManageConfig config)
        {
            if (initialized)
            {
                return;
            }

            this.externalResourcesPath = externalResourcesPath;
            this.config = config;

            groupInfos  = new List <GroupInfo>(config.GroupInfos);
            manageInfos = new List <ManageInfo>(config.ManageInfos);

            initialized = true;
        }
        //----- params -----

        //----- field -----

        //----- property -----

        //----- method -----

        public static void Generate(string externalResourcesPath, AssetManageConfig config)
        {
            var assetManageManager = new AssetManageManager();

            assetManageManager.Initialize(externalResourcesPath, config);

            var manifest = GenerateManifest(assetManageManager);

            ApplyAssetBundleName(assetManageManager, manifest);

            UnityEditorUtility.SaveAsset(manifest);

            AssetDatabase.RemoveUnusedAssetBundleNames();
            AssetDatabase.Refresh();
        }
示例#5
0
        private void Initialize(string externalResourcesPath, AssetManageConfig assetManageConfig)
        {
            // コンパイルが始まったら閉じる.
            CompileNotification.OnCompileStartAsObservable()
            .Subscribe(_ => Close())
            .AddTo(Disposable);

            assetManageConfig.Optimisation();

            assetManageModel = new AssetManageModel();
            assetManageModel.Initialize();

            assetManageManager = new AssetManageManager();
            assetManageManager.Initialize(externalResourcesPath, assetManageConfig);

            manageAssetView = new ManageAssetView();
            manageAssetView.Initialize(assetManageModel, assetManageManager);

            assetManageModel.OnRequestRepaintAsObservable().Subscribe(_ => Repaint()).AddTo(Disposable);
        }
        public static void Build(string externalResourcesPath, AssetManageConfig assetManageConfig)
        {
            var exportPath = GetExportPath();

            if (string.IsNullOrEmpty(exportPath))
            {
                return;
            }

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

            EditorApplication.LockReloadAssemblies();

            try
            {
                // アセット情報ファイルを生成.
                var assetInfoManifest = AssetInfoManifestGenerator.Generate(externalResourcesPath, assetManageConfig);

                // キャッシュ済みアセットバンドルのハッシュ値取得.
                var cachedAssetBundleHashs = BuildAssetBundle.GetCachedAssetBundleHash();

                // CRIアセットを生成.
                #if ENABLE_CRIWARE_ADX || ENABLE_CRIWARE_SOFDEC
                CriAssetGenerator.Generate(exportPath, externalResourcesPath, assetInfoManifest);
                #endif

                // AssetBundleをビルド.
                var assetBundleManifest = BuildAssetBundle.BuildAllAssetBundles();

                // 不要になった古いAssetBundle削除.
                BuildAssetBundle.CleanUnUseAssetBundleFiles();

                // ビルド成果物の情報をAssetInfoManifestに書き込み.

                var assetBundlePath = BuildAssetBundle.GetAssetBundleOutputPath();

                AssetInfoManifestGenerator.SetAssetBundleFileInfo(assetBundlePath, externalResourcesPath, assetBundleManifest);

                #if ENABLE_CRIWARE_ADX || ENABLE_CRIWARE_SOFDEC
                AssetInfoManifestGenerator.SetCriAssetFileInfo(exportPath, externalResourcesPath, assetBundleManifest);
                #endif

                // アセットバンドルの参照情報をAssetInfoManifestに書き込み.
                BuildAssetBundle.SetDependencies(assetInfoManifest, assetBundleManifest);

                // 再度AssetInfoManifestだけビルドを実行.
                BuildAssetBundle.BuildAssetInfoManifest(externalResourcesPath);

                // 更新が必要なパッケージファイルを削除.
                BuildAssetBundle.CleanOldPackage(cachedAssetBundleHashs);

                // AssetBundleファイルをパッケージ化.
                BuildAssetBundle.BuildPackage(exportPath, assetInfoManifest, assetManageConfig.CryptPassword);

                // 出力先フォルダを開く.
                UnityEditorUtility.OpenFolder(exportPath);

                UnityConsole.Event(ExternalResources.ConsoleEventName, ExternalResources.ConsoleEventColor, "Build ExternalResource Complete.");
            }
            catch (Exception e)
            {
                Debug.LogException(e);
                throw;
            }
            finally
            {
                EditorApplication.UnlockReloadAssemblies();
            }
        }