diff --git a/Editor/BatchMode/BatchModeBuilder.cs b/Editor/BatchMode/BatchModeBuilder.cs index 017da01..9445c43 100644 --- a/Editor/BatchMode/BatchModeBuilder.cs +++ b/Editor/BatchMode/BatchModeBuilder.cs @@ -14,17 +14,23 @@ public static async void Execute() throw new Exception($"{nameof(BatchModeBuilder)}: can be run only from the BatchMode!"); } - BatchModeParameters parameters = CommandLineParser.Parse(Environment.CommandLine); + const string key = "--pipeline"; + string pipeline = string.Empty; - string pipelineName = parameters.Pipeline; + if (!CommandLineParser.TryToParseValue(Environment.CommandLine, key, out object v)) + { + throw new Exception($"The pipeline is not assigned from the CommandLine. Use {key} to define a pipeline for execution."); + } + + pipeline = v.ToString(); - if (Find(pipelineName) != null) + if (Find(pipeline) != null) { - await RunBuildPipeline(pipelineName); + await RunBuildPipeline(pipeline); } else { - throw new Exception($"Failed to find a pipeline with name {pipelineName}!"); + throw new Exception($"Failed to find a pipeline with name {pipeline}!"); } } diff --git a/Editor/BatchMode/BatchModeParameters.cs b/Editor/BatchMode/BatchModeParameters.cs deleted file mode 100644 index 3fcc3d9..0000000 --- a/Editor/BatchMode/BatchModeParameters.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace UniTools.Build -{ - public sealed class BatchModeParameters - { - /// - /// The name of the pipeline from the command line - /// - [CommandLineParameter] public string Pipeline = default; - } -} \ No newline at end of file diff --git a/Editor/BatchMode/BatchModeParameters.cs.meta b/Editor/BatchMode/BatchModeParameters.cs.meta deleted file mode 100644 index 57f55b6..0000000 --- a/Editor/BatchMode/BatchModeParameters.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: aa7d8dba7b2146a1b63ea6fd7c6fee13 -timeCreated: 1623335348 \ No newline at end of file diff --git a/Editor/BatchMode/CommandLineParameterAttribute.cs b/Editor/BatchMode/CommandLineParameterAttribute.cs deleted file mode 100644 index 21d3738..0000000 --- a/Editor/BatchMode/CommandLineParameterAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace UniTools.Build -{ - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public sealed class CommandLineParameterAttribute : Attribute - { - } -} \ No newline at end of file diff --git a/Editor/BatchMode/CommandLineParameterAttribute.cs.meta b/Editor/BatchMode/CommandLineParameterAttribute.cs.meta deleted file mode 100644 index 9139c75..0000000 --- a/Editor/BatchMode/CommandLineParameterAttribute.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 115c33e6f55348509e4037f1cc43cf37 -timeCreated: 1623335239 \ No newline at end of file diff --git a/Editor/BatchMode/CommandLineParser.cs b/Editor/BatchMode/CommandLineParser.cs index c5536fb..ddc811d 100644 --- a/Editor/BatchMode/CommandLineParser.cs +++ b/Editor/BatchMode/CommandLineParser.cs @@ -1,62 +1,29 @@ -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using UnityEngine; - namespace UniTools.Build { public static class CommandLineParser { private const string KeyStart = "-"; - public static T Parse(string commandLine) where T : class, new() + public static bool TryToParseValue(string commandLine, string key, out object val) { - T t = new T(); - - Dictionary parameters = new Dictionary(); string[] args = commandLine.Split(' '); for (int i = 0; i < args.Length; i++) { - if (IsKey(args[i])) + if (IsKey(args[i]) && args[i].Equals(key)) { - string key = args[i]; - object val = null; int next = i + 1; if (next < args.Length && !IsKey(args[next])) { val = args[next]; - } - key = key.Replace(KeyStart, string.Empty).ToLower(); - if (parameters.ContainsKey(key)) - { - Debug.LogWarning($"{nameof(CommandLineParser)}: duplication of the parameter {key}"); - parameters[key] = val; - } - else - { - parameters.Add(key, val); + return true; } } } - FieldInfo[] fields = - t.GetType() - .GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) - .Where(f => f.IsDefined(typeof(CommandLineParameterAttribute), false)) - .ToArray() - ; - - foreach (FieldInfo info in fields) - { - string fieldName = info.Name.ToLower(); - if (parameters.TryGetValue(fieldName, out object p)) - { - info.SetValue(t, p ?? true); - } - } + val = null; - return t; + return false; } private static bool IsKey(string param) diff --git a/Editor/Core/CustomEditors/BuildPipelinePresenter.cs b/Editor/Core/CustomEditors/BuildPipelinePresenter.cs deleted file mode 100644 index f3a77c9..0000000 --- a/Editor/Core/CustomEditors/BuildPipelinePresenter.cs +++ /dev/null @@ -1,60 +0,0 @@ -using UnityEditor; -using UnityEngine; - -namespace UniTools.Build -{ - public sealed class BuildPipelinePresenter - { - private readonly BuildPipeline m_buildPipeline = default; - private bool m_foldout = false; - - public BuildPipelinePresenter(BuildPipeline buildPipeline) - { - m_buildPipeline = buildPipeline; - } - - public void Draw() - { - bool run = false; - bool modify = false; - if (m_foldout) - { - EditorGUILayout.BeginVertical("box"); - { - m_foldout = EditorGUILayout.Foldout(m_foldout, m_buildPipeline.name); - DrawButtons(out run, out modify); - } - EditorGUILayout.EndVertical(); - } - else - { - EditorGUILayout.BeginHorizontal("box"); - { - m_foldout = EditorGUILayout.Foldout(m_foldout, m_buildPipeline.name); - DrawButtons(out run, out modify); - } - EditorGUILayout.EndHorizontal(); - } - - if (run) - { - m_buildPipeline.Run().GetAwaiter().OnCompleted(() => { Debug.Log($"Pipeline {m_buildPipeline} is completed!"); }); - } - - if (modify) - { - EditorGUIUtility.PingObject(m_buildPipeline); - } - } - - private void DrawButtons(out bool run, out bool modify) - { - EditorGUILayout.BeginHorizontal(); - { - modify = GUILayout.Button("Modify", GUILayout.Width(100)); - run = GUILayout.Button("Run", GUILayout.Width(100)); - } - EditorGUILayout.EndHorizontal(); - } - } -} \ No newline at end of file diff --git a/Editor/Core/CustomEditors/BuildPipelinesProjectSettingsProvider.cs b/Editor/Core/CustomEditors/BuildPipelinesProjectSettingsProvider.cs deleted file mode 100644 index 1db2058..0000000 --- a/Editor/Core/CustomEditors/BuildPipelinesProjectSettingsProvider.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections.Generic; -using UnityEditor; -using UnityEngine.UIElements; - -namespace UniTools.Build -{ - public sealed class BuildPipelinesProjectSettingsProvider : SettingsProvider - { - [SettingsProvider] - public static SettingsProvider Register() => - new BuildPipelinesProjectSettingsProvider($"Project/{nameof(UniTools)}/Build"); - - private readonly List m_presenters = new List(); - - private BuildPipelinesProjectSettingsProvider(string path) - : base(path, SettingsScope.Project) - { - } - - public override void OnActivate(string searchContext, VisualElement rootElement) - { - m_presenters.Clear(); - - string[] guids = AssetDatabase.FindAssets($"t:{nameof(BuildPipeline)}"); - foreach (string guid in guids) - { - string path = AssetDatabase.GUIDToAssetPath(guid); - BuildPipeline pipline = AssetDatabase.LoadAssetAtPath(path); - m_presenters.Add(new BuildPipelinePresenter(pipline)); - } - } - - public override void OnGUI(string searchContext) - { - foreach (BuildPipelinePresenter presenter in m_presenters) - { - presenter.Draw(); - } - } - } -} \ No newline at end of file diff --git a/Editor/Core/Parameters/BuildParameterPresenter.cs b/Editor/Core/Parameters/BuildParameterPresenter.cs new file mode 100644 index 0000000..a384e1e --- /dev/null +++ b/Editor/Core/Parameters/BuildParameterPresenter.cs @@ -0,0 +1,10 @@ +namespace UniTools.Build +{ + public abstract class BuildParameterPresenter + { + + public abstract string CliKey { get; } + + public abstract void Draw(bool duplicated); + } +} \ No newline at end of file diff --git a/Editor/Core/Parameters/BuildParameterPresenter.cs.meta b/Editor/Core/Parameters/BuildParameterPresenter.cs.meta new file mode 100644 index 0000000..b31d798 --- /dev/null +++ b/Editor/Core/Parameters/BuildParameterPresenter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b8ca3619956845b3a3d7735a2b01d388 +timeCreated: 1678442940 \ No newline at end of file diff --git a/Editor/Core/Parameters/Int.meta b/Editor/Core/Parameters/Int.meta new file mode 100644 index 0000000..ec4327f --- /dev/null +++ b/Editor/Core/Parameters/Int.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6aeb526ebe9c41438c17087b79b8529a +timeCreated: 1678381779 \ No newline at end of file diff --git a/Editor/Core/Parameters/Int/IntBuildParameter.cs b/Editor/Core/Parameters/Int/IntBuildParameter.cs new file mode 100644 index 0000000..c121fa7 --- /dev/null +++ b/Editor/Core/Parameters/Int/IntBuildParameter.cs @@ -0,0 +1,26 @@ +using UnityEngine; + +namespace UniTools.Build +{ + [CreateAssetMenu( + fileName = nameof(StringBuildParameter), + menuName = MenuPaths.Parameters + "Int" + )] + public sealed class IntBuildParameter : ScriptableBuildParameter + { + protected override bool TryParseFromCommandLine(string commandLine, out int v) + { + if (CommandLineParser.TryToParseValue(commandLine, CliKey, out object obj)) + { + if (int.TryParse(obj.ToString(), out v)) + { + return true; + } + } + + v = int.MinValue; + + return false; + } + } +} \ No newline at end of file diff --git a/Editor/Core/Parameters/Int/IntBuildParameter.cs.meta b/Editor/Core/Parameters/Int/IntBuildParameter.cs.meta new file mode 100644 index 0000000..eeabc33 --- /dev/null +++ b/Editor/Core/Parameters/Int/IntBuildParameter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: adb7a217404943c3aa9791700a35b93e +timeCreated: 1678381791 \ No newline at end of file diff --git a/Editor/Core/Parameters/Int/IntBuildParameterEditor.cs b/Editor/Core/Parameters/Int/IntBuildParameterEditor.cs new file mode 100644 index 0000000..d5eeffb --- /dev/null +++ b/Editor/Core/Parameters/Int/IntBuildParameterEditor.cs @@ -0,0 +1,65 @@ +using System.Linq; +using UnityEditor; +using UnityEngine; + +namespace UniTools.Build +{ + [CustomEditor(typeof(IntBuildParameter))] + public sealed class IntBuildParameterEditor : Editor + { + private IntBuildParameter m_target = default; + private SerializedProperty m_value = default; + private SerializedProperty m_options = default; + + private void OnEnable() + { + m_value = serializedObject.FindProperty(nameof(m_value)); + m_options = serializedObject.FindProperty(nameof(m_options)); + m_target = target as IntBuildParameter; + } + + public override void OnInspectorGUI() + { + Draw(m_target, serializedObject, m_value, m_options); + } + + /// + /// This method is using to draw the same editor in different windows + /// + public static void Draw(IntBuildParameter target, SerializedObject serializedObject, SerializedProperty value, SerializedProperty options) + { + bool copyToClipboard = false; + + if (target.Options == null || target.Options.Count <= 0) + { + EditorGUILayout.PropertyField(value); + } + else + { + int index = target.Options.IndexOf(value.intValue); + index = EditorGUILayout.Popup(index, target.Options.Select(o => o.ToString()).ToArray()); + + if (index >= 0 && index <= target.Options.Count) + { + value.intValue = target.Options[index]; + } + } + + EditorGUILayout.PropertyField(options); + + EditorGUILayout.BeginHorizontal(); + { + EditorGUILayout.LabelField($"CLI: {target.CliKey} {value.intValue}"); + copyToClipboard = GUILayout.Button("Copy"); + } + EditorGUILayout.EndHorizontal(); + + serializedObject.ApplyModifiedProperties(); + + if (copyToClipboard) + { + EditorGUIUtility.systemCopyBuffer = $"{target.CliKey} {value.intValue}"; + } + } + } +} \ No newline at end of file diff --git a/Editor/Core/Parameters/Int/IntBuildParameterEditor.cs.meta b/Editor/Core/Parameters/Int/IntBuildParameterEditor.cs.meta new file mode 100644 index 0000000..ce891d3 --- /dev/null +++ b/Editor/Core/Parameters/Int/IntBuildParameterEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6a502df001874324968157c10086b8b0 +timeCreated: 1678381985 \ No newline at end of file diff --git a/Editor/Core/Parameters/Int/IntBuildParameterPresenter.cs b/Editor/Core/Parameters/Int/IntBuildParameterPresenter.cs new file mode 100644 index 0000000..0ac1832 --- /dev/null +++ b/Editor/Core/Parameters/Int/IntBuildParameterPresenter.cs @@ -0,0 +1,71 @@ +using UnityEditor; +using UnityEngine; + +namespace UniTools.Build +{ + public sealed class IntBuildParameterPresenter : BuildParameterPresenter + { + private readonly IntBuildParameter m_target = default; + private readonly SerializedObject m_serializedObject = default; + private readonly SerializedProperty m_value = default; + private readonly SerializedProperty m_options = default; + private bool m_foldout = false; + + public IntBuildParameterPresenter(IntBuildParameter target) + { + m_target = target; + m_serializedObject = new SerializedObject(m_target); + m_value = m_serializedObject.FindProperty(nameof(m_value)); + m_options = m_serializedObject.FindProperty(nameof(m_options)); + } + + public override string CliKey => m_target.CliKey; + + public override void Draw(bool duplicated) + { + bool select = false; + if (m_foldout) + { + EditorGUILayout.BeginVertical("box"); + { + EditorGUILayout.BeginHorizontal(); + { + m_foldout = EditorGUILayout.Foldout(m_foldout, m_target.name, Styles.H2_Foldout); + select = GUILayout.Button("Select", GUILayout.Width(100)); + } + EditorGUILayout.EndHorizontal(); + if (duplicated) + { + EditorGUILayout.HelpBox("The parameter name is duplicated! Logical errors can happen during the batch mode call!", MessageType.Warning); + } + + IntBuildParameterEditor.Draw(m_target, m_serializedObject, m_value, m_options); + } + EditorGUILayout.EndVertical(); + } + else + { + EditorGUILayout.BeginHorizontal("box"); + { + Color color = GUI.color; + + if (duplicated) + { + GUI.color = Color.red; + } + + m_foldout = EditorGUILayout.Foldout(m_foldout, m_target.name, Styles.H2_Foldout); + select = GUILayout.Button("Select", GUILayout.Width(100)); + + GUI.color = color; + } + EditorGUILayout.EndHorizontal(); + } + + if (select) + { + EditorGUIUtility.PingObject(m_target); + } + } + } +} \ No newline at end of file diff --git a/Editor/Core/Parameters/Int/IntBuildParameterPresenter.cs.meta b/Editor/Core/Parameters/Int/IntBuildParameterPresenter.cs.meta new file mode 100644 index 0000000..09ff807 --- /dev/null +++ b/Editor/Core/Parameters/Int/IntBuildParameterPresenter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d8e4b3bfa46c4d7687211654dcdb6b72 +timeCreated: 1678443513 \ No newline at end of file diff --git a/Editor/Core/Parameters/ScriptableBuildParameter.cs b/Editor/Core/Parameters/ScriptableBuildParameter.cs index 2664549..6d20e2e 100644 --- a/Editor/Core/Parameters/ScriptableBuildParameter.cs +++ b/Editor/Core/Parameters/ScriptableBuildParameter.cs @@ -1,11 +1,41 @@ +using System; +using System.Collections.Generic; using UnityEngine; namespace UniTools.Build { /// - /// Any value that can used inside a build pipeline + /// Any value that can used inside a build pipeline and can be overriden from the command line /// - public abstract class ScriptableBuildParameter : ScriptableObject + public abstract class ScriptableBuildParameter : ScriptableObject { + [SerializeField] private TValue m_value = default; + + /// + /// The name of the parameter that can be used inside a command line + /// + public string CliKey => $"--{name.Replace(" ", string.Empty).ToLower()}"; + + /// + /// Is this collection if not empty the values can be selected as enum + /// + [SerializeField, Tooltip("Add values to this collection to create a popup")] private List m_options = default; + + public List Options => m_options; + + public TValue Value + { + get + { + if (Application.isBatchMode && TryParseFromCommandLine(Environment.CommandLine, out TValue v)) + { + return v; + } + + return m_value; + } + } + + protected abstract bool TryParseFromCommandLine(string commandLine, out TValue v); } } \ No newline at end of file diff --git a/Editor/Core/Parameters/String.meta b/Editor/Core/Parameters/String.meta new file mode 100644 index 0000000..d15f034 --- /dev/null +++ b/Editor/Core/Parameters/String.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0ed1b08943b744afaa7a084278628b99 +timeCreated: 1678381752 \ No newline at end of file diff --git a/Editor/Core/Parameters/String/StringBuildParameter.cs b/Editor/Core/Parameters/String/StringBuildParameter.cs new file mode 100644 index 0000000..be197dc --- /dev/null +++ b/Editor/Core/Parameters/String/StringBuildParameter.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +namespace UniTools.Build +{ + [CreateAssetMenu( + fileName = nameof(StringBuildParameter), + menuName = MenuPaths.Parameters + "String" + )] + public sealed class StringBuildParameter : ScriptableBuildParameter + { + protected override bool TryParseFromCommandLine(string commandLine, out string v) + { + if (CommandLineParser.TryToParseValue(commandLine, CliKey, out object obj)) + { + v = obj.ToString(); + + return true; + } + + v = string.Empty; + + return false; + } + } +} \ No newline at end of file diff --git a/Editor/Core/Parameters/String/StringBuildParameter.cs.meta b/Editor/Core/Parameters/String/StringBuildParameter.cs.meta new file mode 100644 index 0000000..079edc1 --- /dev/null +++ b/Editor/Core/Parameters/String/StringBuildParameter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e10929fef8c447abb9c3335155a4ea0d +timeCreated: 1678367513 \ No newline at end of file diff --git a/Editor/Core/Parameters/String/StringBuildParameterEditor.cs b/Editor/Core/Parameters/String/StringBuildParameterEditor.cs new file mode 100644 index 0000000..1a8869d --- /dev/null +++ b/Editor/Core/Parameters/String/StringBuildParameterEditor.cs @@ -0,0 +1,65 @@ +using System.Linq; +using UnityEditor; +using UnityEngine; + +namespace UniTools.Build +{ + [CustomEditor(typeof(StringBuildParameter))] + public sealed class StringBuildParameterEditor : Editor + { + private StringBuildParameter m_target = default; + private SerializedProperty m_value = default; + private SerializedProperty m_options = default; + + private void OnEnable() + { + m_value = serializedObject.FindProperty(nameof(m_value)); + m_options = serializedObject.FindProperty(nameof(m_options)); + m_target = target as StringBuildParameter; + } + + public override void OnInspectorGUI() + { + Draw(m_target, serializedObject, m_value, m_options); + } + + /// + /// This method is using to draw the same editor in different windows + /// + public static void Draw(StringBuildParameter target, SerializedObject serializedObject, SerializedProperty value, SerializedProperty options) + { + bool copyToClipboard = false; + + if (target.Options == null || target.Options.Count <= 0) + { + EditorGUILayout.PropertyField(value); + } + else + { + int index = target.Options.IndexOf(value.stringValue); + index = EditorGUILayout.Popup(index, target.Options.Select(o => o.ToString()).ToArray()); + + if (index >= 0 && index <= target.Options.Count) + { + value.stringValue = target.Options[index]; + } + } + + EditorGUILayout.PropertyField(options); + + EditorGUILayout.BeginHorizontal(); + { + EditorGUILayout.LabelField($"CLI: {target.CliKey} {value.stringValue}"); + copyToClipboard = GUILayout.Button("Copy"); + } + EditorGUILayout.EndHorizontal(); + + serializedObject.ApplyModifiedProperties(); + + if (copyToClipboard) + { + EditorGUIUtility.systemCopyBuffer = $"{target.CliKey} {value.stringValue}"; + } + } + } +} \ No newline at end of file diff --git a/Editor/Core/Parameters/String/StringBuildParameterEditor.cs.meta b/Editor/Core/Parameters/String/StringBuildParameterEditor.cs.meta new file mode 100644 index 0000000..c69a4b0 --- /dev/null +++ b/Editor/Core/Parameters/String/StringBuildParameterEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 87c263969ecc47dd999daa3e86ca98cb +timeCreated: 1678366876 \ No newline at end of file diff --git a/Editor/Core/Parameters/String/StringBuildParameterPresenter.cs b/Editor/Core/Parameters/String/StringBuildParameterPresenter.cs new file mode 100644 index 0000000..fd4e554 --- /dev/null +++ b/Editor/Core/Parameters/String/StringBuildParameterPresenter.cs @@ -0,0 +1,72 @@ +using UnityEditor; +using UnityEngine; + +namespace UniTools.Build +{ + public sealed class StringBuildParameterPresenter : BuildParameterPresenter + { + private readonly StringBuildParameter m_target = default; + private readonly SerializedObject m_serializedObject = default; + private readonly SerializedProperty m_value = default; + private readonly SerializedProperty m_options = default; + + private bool m_foldout = false; + + public StringBuildParameterPresenter(StringBuildParameter target) + { + m_target = target; + m_serializedObject = new SerializedObject(m_target); + m_value = m_serializedObject.FindProperty(nameof(m_value)); + m_options = m_serializedObject.FindProperty(nameof(m_options)); + } + + public override string CliKey => m_target.CliKey; + + public override void Draw(bool duplicated) + { + bool select = false; + if (m_foldout) + { + EditorGUILayout.BeginVertical("box"); + { + EditorGUILayout.BeginHorizontal(); + { + m_foldout = EditorGUILayout.Foldout(m_foldout, m_target.name, Styles.H2_Foldout); + select = GUILayout.Button("Select", GUILayout.Width(100)); + } + EditorGUILayout.EndHorizontal(); + if (duplicated) + { + EditorGUILayout.HelpBox("The parameter name is duplicated! Logical errors can happen during the batch mode call!", MessageType.Warning); + } + + StringBuildParameterEditor.Draw(m_target, m_serializedObject, m_value, m_options); + } + EditorGUILayout.EndVertical(); + } + else + { + EditorGUILayout.BeginHorizontal("box"); + { + Color color = GUI.color; + + if (duplicated) + { + GUI.color = Color.red; + } + + m_foldout = EditorGUILayout.Foldout(m_foldout, m_target.name, Styles.H2_Foldout); + select = GUILayout.Button("Select", GUILayout.Width(100)); + + GUI.color = color; + } + EditorGUILayout.EndHorizontal(); + } + + if (select) + { + EditorGUIUtility.PingObject(m_target); + } + } + } +} \ No newline at end of file diff --git a/Editor/Core/Parameters/String/StringBuildParameterPresenter.cs.meta b/Editor/Core/Parameters/String/StringBuildParameterPresenter.cs.meta new file mode 100644 index 0000000..56ab9ce --- /dev/null +++ b/Editor/Core/Parameters/String/StringBuildParameterPresenter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c544ac55d3a2410a9c10104d0e166463 +timeCreated: 1678442280 \ No newline at end of file diff --git a/Editor/Core/Pipelines/BuildPipeline.cs b/Editor/Core/Pipelines/BuildPipeline.cs index 1a695eb..5e15cb2 100644 --- a/Editor/Core/Pipelines/BuildPipeline.cs +++ b/Editor/Core/Pipelines/BuildPipeline.cs @@ -7,7 +7,7 @@ namespace UniTools.Build { [CreateAssetMenu( fileName = nameof(BuildPipeline), - menuName = MenuPaths.Pipelines + "Pipeline" + menuName = MenuPaths.Core + "Pipeline" )] public sealed class BuildPipeline : ScriptableObject { diff --git a/Editor/Core/CustomEditors.meta b/Editor/Core/Pipelines/CustomEditors.meta similarity index 100% rename from Editor/Core/CustomEditors.meta rename to Editor/Core/Pipelines/CustomEditors.meta diff --git a/Editor/Core/Pipelines/CustomEditors/BuildPipelinePresenter.cs b/Editor/Core/Pipelines/CustomEditors/BuildPipelinePresenter.cs new file mode 100644 index 0000000..af3ed33 --- /dev/null +++ b/Editor/Core/Pipelines/CustomEditors/BuildPipelinePresenter.cs @@ -0,0 +1,89 @@ +using UnityEditor; +using UnityEngine; + +namespace UniTools.Build +{ + public sealed class BuildPipelinePresenter + { + private readonly BuildPipeline m_buildPipeline = default; + private bool m_foldout = false; + + public BuildPipelinePresenter(BuildPipeline buildPipeline) + { + m_buildPipeline = buildPipeline; + } + + public void Draw() + { + bool run = false; + bool select = false; + if (m_foldout) + { + string sh = $"./build.sh --pipeline {m_buildPipeline.name}"; + string ps = $".\\build.ps1 --pipeline {m_buildPipeline.name}"; + bool copySh = false; + bool copyPs = false; + + EditorGUILayout.BeginVertical("box"); + { + EditorGUILayout.BeginHorizontal(); + { + m_foldout = EditorGUILayout.Foldout(m_foldout, m_buildPipeline.name, Styles.H2_Foldout); + run = GUILayout.Button("Run", GUILayout.Width(100)); + } + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.LabelField("CLI commands:"); + EditorGUILayout.BeginHorizontal(); + { + EditorGUILayout.LabelField($"SH: {sh}"); + copySh = GUILayout.Button("Copy"); + } + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.BeginHorizontal(); + { + EditorGUILayout.LabelField($"PS: {ps}"); + copyPs = GUILayout.Button("Copy"); + } + EditorGUILayout.EndHorizontal(); + + select = GUILayout.Button("Select Pipeline", GUILayout.Width(250)); + + if (copySh) + { + EditorGUIUtility.systemCopyBuffer = sh; + } + + if (copyPs) + { + EditorGUIUtility.systemCopyBuffer = ps; + } + } + EditorGUILayout.EndVertical(); + } + else + { + EditorGUILayout.BeginHorizontal("box"); + { + m_foldout = EditorGUILayout.Foldout(m_foldout, m_buildPipeline.name, Styles.H2_Foldout); + run = GUILayout.Button("Run", GUILayout.Width(100)); + } + EditorGUILayout.EndHorizontal(); + } + + if (run) + { + if (EditorUtility.DisplayDialog($"Run {m_buildPipeline.name} pipeline?", "", "Yes", "No")) + { + m_buildPipeline.Run().GetAwaiter().OnCompleted(() => { Debug.Log($"Pipeline {m_buildPipeline} is completed!"); }); + } + } + + if (select) + { + EditorGUIUtility.PingObject(m_buildPipeline); + } + } + } +} \ No newline at end of file diff --git a/Editor/Core/CustomEditors/BuildPipelinePresenter.cs.meta b/Editor/Core/Pipelines/CustomEditors/BuildPipelinePresenter.cs.meta similarity index 100% rename from Editor/Core/CustomEditors/BuildPipelinePresenter.cs.meta rename to Editor/Core/Pipelines/CustomEditors/BuildPipelinePresenter.cs.meta diff --git a/Editor/Core/Pipelines/CustomEditors/BuildPipelinesProjectSettingsProvider.cs b/Editor/Core/Pipelines/CustomEditors/BuildPipelinesProjectSettingsProvider.cs new file mode 100644 index 0000000..09942cc --- /dev/null +++ b/Editor/Core/Pipelines/CustomEditors/BuildPipelinesProjectSettingsProvider.cs @@ -0,0 +1,75 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEditor; +using UnityEngine.UIElements; + +namespace UniTools.Build +{ + public sealed class BuildPipelinesProjectSettingsProvider : SettingsProvider + { + [SettingsProvider] + public static SettingsProvider Register() => + new BuildPipelinesProjectSettingsProvider($"Project/{nameof(UniTools)}/Build"); + + private readonly List m_pipelinePresenters = new List(); + private readonly List m_parameterPresenters = new List(); + private readonly List m_allParameterKeys = new List(); + + private BuildPipelinesProjectSettingsProvider(string path) + : base(path, SettingsScope.Project) + { + } + + public override void OnActivate(string searchContext, VisualElement rootElement) + { + //Find parameters + m_parameterPresenters.Clear(); + m_allParameterKeys.Clear(); + string[] guids = AssetDatabase.FindAssets($"t:{nameof(StringBuildParameter)}"); + foreach (string guid in guids) + { + string path = AssetDatabase.GUIDToAssetPath(guid); + StringBuildParameter parameter = AssetDatabase.LoadAssetAtPath(path); + m_parameterPresenters.Add(new StringBuildParameterPresenter(parameter)); + } + + guids = AssetDatabase.FindAssets($"t:{nameof(IntBuildParameter)}"); + foreach (string guid in guids) + { + string path = AssetDatabase.GUIDToAssetPath(guid); + IntBuildParameter parameter = AssetDatabase.LoadAssetAtPath(path); + m_parameterPresenters.Add(new IntBuildParameterPresenter(parameter)); + } + + m_allParameterKeys.AddRange(m_parameterPresenters.Select(k => k.CliKey)); + + //Find pipelines + m_pipelinePresenters.Clear(); + guids = AssetDatabase.FindAssets($"t:{nameof(BuildPipeline)}"); + foreach (string guid in guids) + { + string path = AssetDatabase.GUIDToAssetPath(guid); + BuildPipeline pipline = AssetDatabase.LoadAssetAtPath(path); + m_pipelinePresenters.Add(new BuildPipelinePresenter(pipline)); + } + } + + public override void OnGUI(string searchContext) + { + EditorGUILayout.LabelField("Parameters", Styles.H1); + + foreach (BuildParameterPresenter presenter in m_parameterPresenters) + { + presenter.Draw(m_allParameterKeys.Count(k => k.Equals(presenter.CliKey)) > 1); + } + + EditorGUILayout.Separator(); + EditorGUILayout.LabelField("Pipelines", Styles.H1); + EditorGUILayout.Space(5); + foreach (BuildPipelinePresenter presenter in m_pipelinePresenters) + { + presenter.Draw(); + } + } + } +} \ No newline at end of file diff --git a/Editor/Core/CustomEditors/BuildPipelinesProjectSettingsProvider.cs.meta b/Editor/Core/Pipelines/CustomEditors/BuildPipelinesProjectSettingsProvider.cs.meta similarity index 100% rename from Editor/Core/CustomEditors/BuildPipelinesProjectSettingsProvider.cs.meta rename to Editor/Core/Pipelines/CustomEditors/BuildPipelinesProjectSettingsProvider.cs.meta diff --git a/Editor/Defines/Pipelines/ApplyDefines.cs b/Editor/Defines/ApplyDefines.cs similarity index 88% rename from Editor/Defines/Pipelines/ApplyDefines.cs rename to Editor/Defines/ApplyDefines.cs index b2dd6b0..c66ef28 100644 --- a/Editor/Defines/Pipelines/ApplyDefines.cs +++ b/Editor/Defines/ApplyDefines.cs @@ -21,7 +21,8 @@ public override async Task Execute() throw new Exception("Invalid define symbols added!"); } - m_symbols.Apply(m_group); + PlayerSettings.SetScriptingDefineSymbolsForGroup(m_group, m_symbols.ToString()); + AssetDatabase.Refresh(); AssetDatabase.SaveAssets(); diff --git a/Editor/Defines/Pipelines/ApplyDefines.cs.meta b/Editor/Defines/ApplyDefines.cs.meta similarity index 100% rename from Editor/Defines/Pipelines/ApplyDefines.cs.meta rename to Editor/Defines/ApplyDefines.cs.meta diff --git a/Editor/Defines/Models.meta b/Editor/Defines/Models.meta deleted file mode 100644 index e3f3bd2..0000000 --- a/Editor/Defines/Models.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 15a2ed9f7f75492ebeed1cfb3f1d284f -timeCreated: 1612532253 \ No newline at end of file diff --git a/Editor/Defines/Pipelines.meta b/Editor/Defines/Pipelines.meta deleted file mode 100644 index 1b69e66..0000000 --- a/Editor/Defines/Pipelines.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: d1fbc9e682714ea7835c8af86f17071d -timeCreated: 1617626154 \ No newline at end of file diff --git a/Editor/Defines/Presenters.meta b/Editor/Defines/Presenters.meta deleted file mode 100644 index ec70ee1..0000000 --- a/Editor/Defines/Presenters.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0ac82ffa7e11e46839019bd26fa69cb2 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/Defines/Presenters/ScriptingDefineSymbolsPresenter.cs b/Editor/Defines/Presenters/ScriptingDefineSymbolsPresenter.cs deleted file mode 100644 index ee27de4..0000000 --- a/Editor/Defines/Presenters/ScriptingDefineSymbolsPresenter.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using UnityEditor; -using UnityEngine; - -namespace UniTools.Build -{ - public sealed class ScriptingDefineSymbolsPresenter - { - private readonly BuildTargetGroup m_target = default; - private readonly ScriptingDefineSymbols[] m_defines = default; - private readonly string[] m_names = default; - private ScriptingDefineSymbols m_current = default; - private string m_currentSymbols = default; - private int m_index = 0; - private bool m_foldout = false; - - public ScriptingDefineSymbolsPresenter( - BuildTargetGroup target, - IEnumerable defines) - { - m_target = target; - m_defines = defines.ToArray(); - m_names = m_defines.Select(d => d.name).ToArray(); - Refresh(); - } - - public void Draw() - { - if (m_current == null) - { - EditorGUILayout.HelpBox("No any defines set is applied for this platform!", MessageType.Warning); - } - - m_foldout = EditorGUILayout.Foldout(m_foldout, m_current != null ? $"Applied set is {m_current.name}" : "Custom defines"); - if (m_foldout) - { - EditorGUILayout.LabelField(m_currentSymbols); - } - - bool apply = false; - bool select = false; - EditorGUILayout.BeginHorizontal("box"); - { - m_index = EditorGUILayout.Popup(m_index, m_names); - GUI.enabled = m_current == null || !m_current.Equals(m_defines[m_index]); - apply = GUILayout.Button("Apply", GUILayout.Width(100)); - GUI.enabled = true; - select = GUILayout.Button("Select", GUILayout.Width(100)); - } - EditorGUILayout.EndHorizontal(); - - if (select) - { - EditorGUIUtility.PingObject(m_defines[m_index]); - } - - if (apply) - { - apply = EditorUtility.DisplayDialog("Are you sure?", $"Defines set for {m_target.ToString()} will be changed to {m_defines[m_index].name}.", "Yes", "No"); - } - - if (apply) - { - m_defines[m_index].Apply(m_target); - Refresh(); - } - } - - private void Refresh() - { - m_currentSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(m_target); - for (int i = 0; i < m_defines.Length; i++) - { - if (m_defines[i].ToString().Equals(m_currentSymbols)) - { - m_index = i; - m_current = m_defines[i]; - m_currentSymbols = m_current.ToString(); - - break; - } - } - } - } -} \ No newline at end of file diff --git a/Editor/Defines/Presenters/ScriptingDefineSymbolsPresenter.cs.meta b/Editor/Defines/Presenters/ScriptingDefineSymbolsPresenter.cs.meta deleted file mode 100644 index 13e19ca..0000000 --- a/Editor/Defines/Presenters/ScriptingDefineSymbolsPresenter.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: d4337b5566cc4f83ad57184c80de0432 -timeCreated: 1617025567 \ No newline at end of file diff --git a/Editor/Defines/Presenters/ScriptingDefineSymbolsProvider.cs b/Editor/Defines/Presenters/ScriptingDefineSymbolsProvider.cs deleted file mode 100644 index ec675e3..0000000 --- a/Editor/Defines/Presenters/ScriptingDefineSymbolsProvider.cs +++ /dev/null @@ -1,115 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEditor; -using UnityEngine; -using UnityEngine.UIElements; - -namespace UniTools.Build -{ - public sealed class ScriptingDefineSymbolsProvider : SettingsProvider - { - [SettingsProvider] - public static SettingsProvider Register() => - new ScriptingDefineSymbolsProvider($"Project/{nameof(UniTools)}/Configuration/Scripting Define Symbols"); - - private static readonly BuildTargetGroup[] Targets = - { - BuildTargetGroup.Standalone, - BuildTargetGroup.iOS, - BuildTargetGroup.Android - }; - - private readonly string[] m_toolbarOptions = default; - - private readonly Dictionary m_presenters = new Dictionary(); - private ScriptingDefineSymbolsPresenter m_presenter = default; - private int m_currentToolbarIndex = 0; - - private ScriptingDefineSymbolsProvider(string path) - : base(path, SettingsScope.Project) - { - m_toolbarOptions = Targets.Select(t => t.ToString()).ToArray(); - } - - public override void OnActivate(string searchContext, VisualElement rootElement) - { - Refresh(); - base.OnActivate(searchContext, rootElement); - } - - public override void OnDeactivate() - { - m_presenters.Clear(); - m_presenter = default; - base.OnDeactivate(); - } - - public override void OnGUI(string searchContext) - { - int prev = m_currentToolbarIndex; - bool refresh = false; - - EditorGUILayout.BeginHorizontal(); - { - m_currentToolbarIndex = GUILayout.Toolbar(m_currentToolbarIndex, m_toolbarOptions); - refresh = GUILayout.Button("R", GUILayout.Width(25)); - } - EditorGUILayout.EndHorizontal(); - - if (refresh) - { - Refresh(); - - return; - } - - if (prev != m_currentToolbarIndex || m_presenter == null) - { - m_presenter = m_presenters[ToolboxIndexToTarget(m_currentToolbarIndex)]; - } - - if (EditorApplication.isCompiling) - { - EditorGUILayout.LabelField("Compiling, please wait..."); - - return; - } - - EditorGUILayout.BeginVertical("box"); - { - m_presenter.Draw(); - } - EditorGUILayout.EndVertical(); - } - - private void Refresh() - { - m_presenters.Clear(); - m_presenter = default; - string[] guids = AssetDatabase.FindAssets($"t:{nameof(ScriptingDefineSymbols)}"); - ScriptingDefineSymbols[] defines = new ScriptingDefineSymbols[guids.Length]; - - for (int i = 0; i < guids.Length; i++) - { - string path = AssetDatabase.GUIDToAssetPath(guids[i]); - defines[i] = AssetDatabase.LoadAssetAtPath(path); - } - - foreach (BuildTargetGroup targetGroup in Targets) - { - m_presenters.Add(targetGroup, new ScriptingDefineSymbolsPresenter(targetGroup, defines)); - } - } - - private static BuildTargetGroup ToolboxIndexToTarget(int index) - { - if (index < Targets.Length) - { - return Targets[index]; - } - - throw new Exception($"Unsupported index {index}!"); - } - } -} \ No newline at end of file diff --git a/Editor/Defines/Presenters/ScriptingDefineSymbolsProvider.cs.meta b/Editor/Defines/Presenters/ScriptingDefineSymbolsProvider.cs.meta deleted file mode 100644 index 5a52d4d..0000000 --- a/Editor/Defines/Presenters/ScriptingDefineSymbolsProvider.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 4c3bdf2566c4f4c15b129849f599a978 -timeCreated: 1610023385 \ No newline at end of file diff --git a/Editor/Defines/Models/ScriptingDefineSymbols.cs b/Editor/Defines/ScriptingDefineSymbols.cs similarity index 68% rename from Editor/Defines/Models/ScriptingDefineSymbols.cs rename to Editor/Defines/ScriptingDefineSymbols.cs index 5552a8b..c7a27d2 100644 --- a/Editor/Defines/Models/ScriptingDefineSymbols.cs +++ b/Editor/Defines/ScriptingDefineSymbols.cs @@ -1,6 +1,6 @@ +using System; using System.Collections.Generic; using System.Text; -using UnityEditor; using UnityEngine; namespace UniTools.Build @@ -13,13 +13,19 @@ public sealed class ScriptingDefineSymbols : ScriptableObject { [SerializeField] private List m_defines = new List(); - public void Apply(BuildTargetGroup buildTargetGroup) - { - PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, ToString()); - } + /// + /// The name of the parameter that can be used inside a command line + /// + public string CliKey => $"--{name.ToLower()}"; public override string ToString() { + //in case + if (Application.isBatchMode && CommandLineParser.TryToParseValue(Environment.CommandLine, CliKey, out object obj)) + { + return obj.ToString(); + } + if (m_defines.Count == 0) { return string.Empty; diff --git a/Editor/Defines/Models/ScriptingDefineSymbols.cs.meta b/Editor/Defines/ScriptingDefineSymbols.cs.meta similarity index 100% rename from Editor/Defines/Models/ScriptingDefineSymbols.cs.meta rename to Editor/Defines/ScriptingDefineSymbols.cs.meta diff --git a/Editor/Defines/ScriptingDefineSymbolsEditor.cs b/Editor/Defines/ScriptingDefineSymbolsEditor.cs new file mode 100644 index 0000000..9089312 --- /dev/null +++ b/Editor/Defines/ScriptingDefineSymbolsEditor.cs @@ -0,0 +1,36 @@ +using UnityEditor; +using UnityEngine; + +namespace UniTools.Build +{ + [CustomEditor(typeof(ScriptingDefineSymbols))] + public sealed class ScriptingDefineSymbolsEditor : Editor + { + private ScriptingDefineSymbols m_target = default; + + private void OnEnable() + { + m_target = target as ScriptingDefineSymbols; + } + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + bool copyToClipboard = false; + + EditorGUILayout.BeginHorizontal(); + { + EditorGUILayout.LabelField($"CLI: {m_target.CliKey} \"{m_target.ToString()}\""); + copyToClipboard = GUILayout.Button("Copy"); + } + EditorGUILayout.EndHorizontal(); + + serializedObject.ApplyModifiedProperties(); + + if (copyToClipboard) + { + EditorGUIUtility.systemCopyBuffer = $"{m_target.CliKey} \"{m_target.ToString()}\""; + } + } + } +} \ No newline at end of file diff --git a/Editor/Defines/ScriptingDefineSymbolsEditor.cs.meta b/Editor/Defines/ScriptingDefineSymbolsEditor.cs.meta new file mode 100644 index 0000000..0fcee90 --- /dev/null +++ b/Editor/Defines/ScriptingDefineSymbolsEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 17d24a9bf64e403f84a51648fc823033 +timeCreated: 1678430751 \ No newline at end of file diff --git a/Editor/MenuPaths.cs b/Editor/MenuPaths.cs index 6974bce..87eb390 100644 --- a/Editor/MenuPaths.cs +++ b/Editor/MenuPaths.cs @@ -3,14 +3,14 @@ namespace UniTools.Build public static class MenuPaths { public const string Core = nameof(UniTools) + "/"; - public const string IO = Core + "IO/"; - public const string Pipelines = Core + "Pipelines/"; + public const string IO = Steps + "IO/"; + public const string Parameters = Core + "Parameters/"; - public const string Build = Core + "Build/"; - public const string Defines = Build + "Defines/"; - public const string Versioning = Build + "Versioning/"; + public const string Steps = Core + "Steps/"; + public const string Defines = Steps + "Defines/"; + public const string Versioning = Steps + "Versioning/"; - private const string Platforms = Build + "Platforms/"; + private const string Platforms = Steps + "Platforms/"; public const string Android = Platforms + "Android/"; public const string IOS = Platforms + "iOS/"; public const string Standalone = Platforms + "Standalone/"; diff --git a/Editor/Platforms/Android/Build/BuildAab.cs b/Editor/Platforms/Android/Build/BuildAab.cs new file mode 100644 index 0000000..cb5fc7c --- /dev/null +++ b/Editor/Platforms/Android/Build/BuildAab.cs @@ -0,0 +1,32 @@ +using System; +using System.Threading.Tasks; +using UnityEditor; +using UnityEditor.Build.Reporting; +using UnityEngine; + +namespace UniTools.Build +{ + [CreateAssetMenu( + fileName = nameof(BuildAab), + menuName = MenuPaths.Android + nameof(BuildAab) + )] + public sealed class BuildAab: UnityBuildStepWithOptions + { + public override BuildTarget Target => BuildTarget.Android; + + public override async Task Execute() + { + BuildPlayerOptions buildPlayerOptions = Options; + EditorUserBuildSettings.buildAppBundle=true; + EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle; + BuildReport report = UnityEditor.BuildPipeline.BuildPlayer(buildPlayerOptions); + await Task.CompletedTask; + + BuildSummary summary = report.summary; + if (summary.result == BuildResult.Failed) + { + throw new Exception($"{nameof(BuildPipeline)}: {name} Build failed!"); + } + } + } +} \ No newline at end of file diff --git a/Editor/Platforms/Android/Build/BuildAab.cs.meta b/Editor/Platforms/Android/Build/BuildAab.cs.meta new file mode 100644 index 0000000..8cfb1b1 --- /dev/null +++ b/Editor/Platforms/Android/Build/BuildAab.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ca76892c383c56349ab81c99d636205f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/Styles.meta b/Editor/Styles.meta new file mode 100644 index 0000000..d081d33 --- /dev/null +++ b/Editor/Styles.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 64667b2471ca45d3bb7f5077d8f1e866 +timeCreated: 1678457997 \ No newline at end of file diff --git a/Editor/Styles/Styles.cs b/Editor/Styles/Styles.cs new file mode 100644 index 0000000..67d6073 --- /dev/null +++ b/Editor/Styles/Styles.cs @@ -0,0 +1,36 @@ +using UnityEditor; +using UnityEngine; + +namespace UniTools.Build +{ + public static class Styles + { + public static readonly GUIStyle H1 = CreateStyle(16, FontStyle.Bold, new Color(0.7333333f, 0.7333333f, 0.7333333f)); + + public static readonly GUIStyle H2_Foldout = CustomFoldout(14, FontStyle.Italic, Color.white); + + private static GUIStyle CreateStyle(int size, FontStyle fontStyle, Color textColor) + { + // this is setting up all kinds of styles for any given field: + GUIStyle style = new GUIStyle(); + style.fontSize = size; + style.fontStyle = fontStyle; + style.normal.textColor = textColor; + + return style; + } + + private static GUIStyle CustomFoldout(int size, FontStyle fontStyle, Color textColor) + { + GUIStyle style = new GUIStyle(EditorStyles.foldout); + + style.fontSize = size; + style.fontStyle = fontStyle; + style.normal.textColor = textColor; + style.active.textColor = textColor; + style.focused.textColor = textColor; + + return style; + } + } +} \ No newline at end of file diff --git a/Editor/Styles/Styles.cs.meta b/Editor/Styles/Styles.cs.meta new file mode 100644 index 0000000..5544a5f --- /dev/null +++ b/Editor/Styles/Styles.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fa7846872b564e28a65bae668311a134 +timeCreated: 1678458005 \ No newline at end of file diff --git a/package.json b/package.json index d20d7c7..e513a65 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "displayName": "UniTools.Build", "name": "com.unitools.build", - "version": "0.1.2-preview", + "version": "0.1.3-preview", "unity": "2019.1", "description": "Customizable Build Pipeline for Unity3D", "keywords": [