From c9a4e6b46de3b79b8c6d1fa6bac2814498783502 Mon Sep 17 00:00:00 2001 From: Tiranice <35855236+Tiranice@users.noreply.github.com> Date: Mon, 15 Nov 2021 19:19:13 -0600 Subject: [PATCH] Update BuildTool.cs --- .../Editor/BuildTools/BuildTool.cs | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Assets/TirUtilities/Editor/BuildTools/BuildTool.cs b/Assets/TirUtilities/Editor/BuildTools/BuildTool.cs index 563ed63..541c2bf 100644 --- a/Assets/TirUtilities/Editor/BuildTools/BuildTool.cs +++ b/Assets/TirUtilities/Editor/BuildTools/BuildTool.cs @@ -12,15 +12,15 @@ internal sealed class BuildToolWindow : EditorWindow { #region Prefs Keys - private const string _BuildPathKey = "TirUtilities.BuildPath."; - private const string _GitTargethKey = "TirUtilities.GitTarget."; + private const string _BuildPathKey = "TirUtilities.BuildPath"; + private const string _GitTargethKey = "TirUtilities.GitTarget"; #endregion #region Editor Prefs Items - private static readonly Prefs.EditorPrefsString _BuildPathPref = new Prefs.EditorPrefsString(_BuildPathKey, new GUIContent("Build Path"), string.Empty); - private static readonly Prefs.EditorPrefsString _GitTargetPref = new Prefs.EditorPrefsString(_GitTargethKey, new GUIContent("Git Target"), BuildTool.GitTarget.CurrentBranch.ToString()); + private static Prefs.EditorPrefsString _BuildPathPref; + private static Prefs.EditorPrefsString _GitTargetPref; #endregion @@ -46,6 +46,18 @@ internal sealed class BuildToolWindow : EditorWindow #region Unity Messages + private void OnEnable() + { + var assetsPath = Application.dataPath; + var path = Path.Combine(assetsPath.Substring(0, assetsPath.LastIndexOf('/')).Replace('/', Path.DirectorySeparatorChar), "Builds"); + _BuildPathPref = new Prefs.EditorPrefsString($"{PlayerSettings.productName}.{_BuildPathKey}", + new GUIContent("Build Path"), + path); + + _GitTargetPref = new Prefs.EditorPrefsString($"{PlayerSettings.productName}.{_GitTargethKey}", + new GUIContent("Git Target"), + BuildTool.GitTarget.CurrentBranch.ToString()); + } private void CreateGUI() { var buildLocation = new Button(SetBuildLoction) { text = "Select Build Location" }; @@ -90,7 +102,6 @@ private void SetGetTarget(ChangeEvent value) _GitTargetPref.Value = _gitTarget.ToString(); } - private static void SetBuildLoction() { _BuildPathPref.Value = EditorUtility.OpenFolderPanel("Build Location...",