private static void Run() { AssetBundleBuilderController controller = new AssetBundleBuilderController(); if (!controller.Load()) { throw new GameFrameworkException("Load configuration failure."); } else { Debug.Log("Load configuration success."); } if (!controller.IsValidOutputDirectory) { throw new GameFrameworkException(string.Format("Output directory '{0}' is invalid.", controller.OutputDirectory)); } if (!controller.BuildAssetBundles()) { throw new GameFrameworkException("Build AssetBundles failure."); } else { Debug.Log("Build AssetBundles success."); controller.Save(); } }
private void OnEnable() { m_Controller = new AssetBundleBuilderController(); m_Controller.OnLoadingAssetBundle += OnLoadingAssetBundle; m_Controller.OnLoadingAsset += OnLoadingAsset; m_Controller.OnLoadCompleted += OnLoadCompleted; m_Controller.OnAnalyzingAsset += OnAnalyzingAsset; m_Controller.OnAnalyzeCompleted += OnAnalyzeCompleted; m_Controller.ProcessingAssetBundle += OnProcessingAssetBundle; m_Controller.ProcessAssetBundleComplete += OnProcessAssetBundleComplete; m_Controller.BuildAssetBundlesError += OnBuildAssetBundlesError; m_OrderBuildAssetBundles = false; if (m_Controller.Load()) { Debug.Log("Load configuration success."); m_BuildEventHandlerTypeNameIndex = 0; string[] buildEventHandlerTypeNames = m_Controller.GetBuildEventHandlerTypeNames(); for (int i = 0; i < buildEventHandlerTypeNames.Length; i++) { if (m_Controller.BuildEventHandlerTypeName == buildEventHandlerTypeNames[i]) { m_BuildEventHandlerTypeNameIndex = i; break; } } m_Controller.RefreshBuildEventHandler(); } else { Debug.LogWarning("Load configuration failure."); } }