private void OnGUIFileInfo(AssetBundleBuildInfo info) { EditorGUILayout.BeginHorizontal(); if (!info.IsInAssetDataBase) { GUI.color = Color.red; GUI.enabled = false; } if (info.IsMenifest) { GUI.color = Color.green; GUI.enabled = false; } if (info.IsNew) { GUI.color = Color.yellow; } if (info.IsNew) { GUI.color = Color.cyan; } info.IsPublish = EditorGUILayout.ToggleLeft(info.AssetBundleName, info.IsPublish, EditorStyles.boldLabel, GUILayout.Width(150f)); string relativePath = EnvUtil.MakeRelative(info.FullPath, AssetBundleBuildSetting.AbsoluteOutputPath); EditorGUILayout.LabelField(relativePath); EditorGUILayout.EndHorizontal(); GUI.color = Color.white; GUI.enabled = true; }
public void OnGUIMenu(int window) { menuscrollPosition = EditorGUILayout.BeginScrollView(menuscrollPosition); EditorGUILayout.LabelField("Build Target", CreateGUIStyle(11, new Color(0.8f, 0.8f, 0.8f, 1.0f), FontStyle.Bold)); EditorGUILayout.LabelField(EditorUserBuildSettings.activeBuildTarget.ToString()); EditorGUILayout.LabelField("Output Path", CreateGUIStyle(11, new Color(0.8f, 0.8f, 0.8f, 1.0f), FontStyle.Bold)); GUI.enabled = false; EditorGUILayout.TextField(AssetBundleBuildSetting.RelativeOutputPath); GUI.enabled = true; if (GUILayout.Button("Find")) { string result = EditorUtility.OpenFolderPanel("Select Output Path", AssetBundleBuildSetting.RelativeOutputPath, ""); if (!string.IsNullOrEmpty(result)) { string relativePath = EnvUtil.MakeRelative(result, System.Environment.CurrentDirectory); AssetBundleBuildSetting.RelativeOutputPath = relativePath; CachedFileInfo(); } } EditorGUILayout.Separator(); GUI.color = Color.green; if (GUILayout.Button("Build")) { CachedFileInfo(); List <string> changedList = AssetBundleBuilder.BuildAssetBundle(EditorUserBuildSettings.activeBuildTarget, AssetBundleBuildSetting.AbsoluteOutputPath); foreach (var c in changedList) { var ret = this.assetBundleList.Find(o => o.AssetBundleName.Equals(c)); if (ret != null) { ret.IsChanged = true; } else { var path = AssetBundleBuilder.GetAssetBundlePath(EditorUserBuildSettings.activeBuildTarget, AssetBundleBuildSetting.AbsoluteOutputPath); var fileInfo = new System.IO.FileInfo(path); this.assetBundleList.Add(new AssetBundleBuildInfo(fileInfo, EditorUserBuildSettings.activeBuildTarget, AssetBundleBuildSetting.AbsoluteOutputPath)); } } } GUI.color = Color.white; EditorGUILayout.LabelField("PublishSetting", CreateGUIStyle(11, new Color(0.8f, 0.8f, 0.8f, 1.0f), FontStyle.Bold)); AssetBundleBuildSetting.PublishState = (AssetBundleBuildSetting.PublishStateEnum)EditorGUILayout.EnumPopup(AssetBundleBuildSetting.PublishState); if (AssetBundleBuildSetting.PublishState == AssetBundleBuildSetting.PublishStateEnum.ShellScript) { EditorGUILayout.LabelField("Shellscript"); AssetBundleBuildSetting.ShellScript = EditorGUILayout.TextArea(AssetBundleBuildSetting.ShellScript, GUILayout.Height(100)); EditorGUILayout.HelpBox("AssetBundle OutputPath is set in EnvironmentVariables 'AssetBundlePath' " + System.Environment.NewLine + " ex) $AssetBundlePath ,%AssetBundlePath%", MessageType.Info); } GUI.color = Color.green; if (GUILayout.Button("Publish")) { foreach (var assetBundle in this.assetBundleList) { if (!assetBundle.IsInAssetDataBase) { assetBundle.DeleteFile(); } } if (AssetBundleBuildSetting.PublishState == AssetBundleBuildSetting.PublishStateEnum.ShellScript) { PublishToShellScript(); } else if (AssetBundleBuildSetting.PublishState == AssetBundleBuildSetting.PublishStateEnum.Streaming) { PublishToStreaming(); } CachedFileInfo(); } GUI.color = Color.white; EditorGUILayout.EndScrollView(); }