Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update BuildTool.cs #3

Merged
merged 1 commit into from
Nov 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions Assets/TirUtilities/Editor/BuildTools/BuildTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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" };
Expand Down Expand Up @@ -90,7 +102,6 @@ private void SetGetTarget(ChangeEvent<System.Enum> value)
_GitTargetPref.Value = _gitTarget.ToString();
}


private static void SetBuildLoction()
{
_BuildPathPref.Value = EditorUtility.OpenFolderPanel("Build Location...",
Expand Down