Navigation tools upgraded to use the new MainToolbarElement API

This commit is contained in:
Anders Ejlersen 2025-12-06 15:17:30 +01:00
parent 708b99f763
commit 3e1602162c
52 changed files with 837 additions and 66 deletions

View file

@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [2.0.0] - 2025-12-06
- Navigation tools upgraded to use the new `MainToolbarElement` API
## [1.11.4] - 2025-09-21 ## [1.11.4] - 2025-09-21
### Fixed ### Fixed

View file

@ -1,7 +1,13 @@
using UnityEngine; using UnityEngine;
#if UNITY_6000_3_OR_NEWER
using System;
#endif
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
#if UNITY_6000_3_OR_NEWER
[Obsolete("Unity has added a new API for adding elements to the main toolbar. Check: <url=https://docs.unity3d.com/6000.3/Documentation/ScriptReference/Toolbars.MainToolbarElement.html>MainToolbarElement</url>.")]
#endif
public abstract class AbstractToolbarDrawer public abstract class AbstractToolbarDrawer
{ {
public abstract bool Visible { get; } public abstract bool Visible { get; }
@ -9,18 +15,22 @@ namespace Module.NavigationTool.Editor.Toolbar
public abstract EToolbarPlacement Placement { get; } public abstract EToolbarPlacement Placement { get; }
public abstract int Priority { get; } public abstract int Priority { get; }
private Rect rect;
protected Styles styles; protected Styles styles;
#if !UNITY_6000_3_OR_NEWER
private Rect rect;
public void Setup(Rect rect) public void Setup(Rect rect)
{ {
this.rect = rect; this.rect = rect;
} }
#endif
public virtual void Update() public virtual void Update()
{ {
} }
#if !UNITY_6000_3_OR_NEWER
public void OnGUI() public void OnGUI()
{ {
if (styles == null) if (styles == null)
@ -32,6 +42,7 @@ namespace Module.NavigationTool.Editor.Toolbar
Draw(rect); Draw(rect);
GUI.enabled = true; GUI.enabled = true;
} }
#endif
protected abstract void Draw(Rect rect); protected abstract void Draw(Rect rect);
public abstract float CalculateWidth(); public abstract float CalculateWidth();

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b007385b54fa43af8050fe2edd5b0174
timeCreated: 1765022906

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2bb70affaf1b42d9b59779683dbbb62d
timeCreated: 1765023522

View file

@ -0,0 +1,22 @@
#if UNITY_6000_3_OR_NEWER
using System.Linq;
using UnityEditor;
namespace Module.NavigationTool.Editor.Toolbar
{
internal sealed class MainToolbarScenePickerPostProcess : AssetPostprocessor
{
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
if (HasChange(deletedAssets) || HasChange(movedAssets) || HasChange(importedAssets))
MainToolbarScenePickerElement.Refresh();
}
private static bool HasChange(string[] assets)
{
return assets.Any(s => s.EndsWith(".unity")) ||
assets.Any(s => s.EndsWith("EditorBuildSettings.asset"));
}
}
}
#endif

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1a8274c0b09c4ccf99d08c1e6db45331
timeCreated: 1765023528

View file

@ -0,0 +1,64 @@
#if UNITY_6000_3_OR_NEWER
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
namespace Module.NavigationTool.Editor.Toolbar
{
[InitializeOnLoad]
internal static class MainToolbarScenePickerStateChanged
{
static MainToolbarScenePickerStateChanged()
{
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
SceneManager.activeSceneChanged += OnActiveSceneChanged;
SceneManager.sceneLoaded += OnSceneLoaded;
SceneManager.sceneUnloaded += OnSceneUnloaded;
EditorSceneManager.newSceneCreated += OnNewSceneCreated;
EditorSceneManager.activeSceneChangedInEditMode += OnActiveSceneChangedInEditMode;
EditorSceneManager.sceneOpened += OnSceneOpened;
EditorSceneManager.sceneClosed += OnSceneClosed;
}
private static void OnPlayModeStateChanged(PlayModeStateChange state)
{
MainToolbarScenePickerElement.Refresh();
}
private static void OnActiveSceneChanged(Scene current, Scene next)
{
MainToolbarScenePickerElement.Refresh();
}
private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
MainToolbarScenePickerElement.Refresh();
}
private static void OnSceneUnloaded(Scene arg0)
{
MainToolbarScenePickerElement.Refresh();
}
private static void OnActiveSceneChangedInEditMode(Scene from, Scene to)
{
MainToolbarScenePickerElement.Refresh();
}
private static void OnNewSceneCreated(Scene scene, NewSceneSetup setup, NewSceneMode mode)
{
MainToolbarScenePickerElement.Refresh();
}
private static void OnSceneOpened(Scene scene, OpenSceneMode mode)
{
MainToolbarScenePickerElement.Refresh();
}
private static void OnSceneClosed(Scene scene)
{
MainToolbarScenePickerElement.Refresh();
}
}
}
#endif

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0c9bd16d885949239ac6b9f7ce1825ec
timeCreated: 1765023528

View file

@ -0,0 +1,47 @@
#if UNITY_6000_3_OR_NEWER
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
namespace Module.NavigationTool.Editor.Toolbar
{
[InitializeOnLoad]
internal static class MainToolbarUIStateChanged
{
static MainToolbarUIStateChanged()
{
EditorSceneManager.sceneSaved += OnSceneSaved;
EditorSceneManager.sceneOpened += OnSceneOpened;
EditorSceneManager.sceneClosed += OnSceneClosed;
PrefabStage.prefabStageOpened += OnPrefabStageOpened;
PrefabStage.prefabStageClosing += OnPrefabStageClosing;
}
private static void OnSceneSaved(Scene scene)
{
MainToolbarUIElement.Refresh();
}
private static void OnSceneOpened(Scene scene, OpenSceneMode mode)
{
MainToolbarUIElement.Refresh();
}
private static void OnSceneClosed(Scene scene)
{
MainToolbarUIElement.Refresh();
}
private static void OnPrefabStageOpened(PrefabStage stage)
{
MainToolbarUIElement.Refresh();
}
private static void OnPrefabStageClosing(PrefabStage stage)
{
MainToolbarUIElement.Refresh();
}
}
}
#endif

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 21f843e3d88741ef985041ddb1fa986d
timeCreated: 1765024267

View file

@ -0,0 +1,103 @@
#if UNITY_6000_3_OR_NEWER
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
using UnityEditor.Toolbars;
using UnityEngine;
using UnityEngine.Scripting;
namespace Module.NavigationTool.Editor.Toolbar
{
internal static class MainToolbarBuildElement
{
[Preserve]
[MainToolbarElement("Toolbar/Build", ussName = "", defaultDockIndex = 0, defaultDockPosition = MainToolbarDockPosition.Middle, menuPriority = 500)]
public static IEnumerable<MainToolbarElement> Draw()
{
var target = EditorUserBuildSettings.activeBuildTarget;
var group = BuildPipeline.GetBuildTargetGroup(target);
return new List<MainToolbarElement>(2)
{
new MainToolbarDropdown(new MainToolbarContent("Build", "Select build or build & run options"), OnBuildDropdownOpened),
new MainToolbarDropdown(GetButtonContent(group), OnBuildTargetDropdownOpened)
};
}
private static void OnBuildDropdownOpened(Rect rect)
{
var menu = new GenericMenu();
menu.AddItem(new GUIContent("Build", "Build project with current EditorBuildSettings and target platform"), false, () => Build(false));
menu.AddItem(new GUIContent("Build & Run", "Build & Run project with current EditorBuildSettings and target platform"), false, () => Build(false));
menu.DropDown(rect);
}
private static void OnBuildTargetDropdownOpened(Rect rect)
{
var menu = new GenericMenu();
var type = typeof(BuildTarget);
var values = Enum.GetValues(type);
for (var i = 0; i < values.Length; i++)
{
var target = (BuildTarget)values.GetValue(i);
var group = BuildPipeline.GetBuildTargetGroup(target);
if (target < 0 || !BuildPipeline.IsBuildTargetSupported(group, target))
continue;
if (!IsValid(type, target))
continue;
menu.AddItem(new GUIContent(ObjectNames.NicifyVariableName(target.ToString())), false, () => SetBuildTargetTo(group, target));
}
menu.DropDown(rect);
}
private static void SetBuildTargetTo(BuildTargetGroup group, BuildTarget target)
{
if (EditorUserBuildSettings.SwitchActiveBuildTarget(group, target))
MainToolbar.Refresh("Toolbar/Build Targets");
}
private static bool IsValid(Type type, BuildTarget target)
{
var members = type.GetMember(target.ToString(), BindingFlags.Public | BindingFlags.Static);
if (members.Length == 0)
return false;
for (var j = 0; j < members.Length; j++)
{
if (members[j].GetCustomAttribute<ObsoleteAttribute>() == null)
return true;
}
return false;
}
private static GUIContent GetButtonContent(BuildTargetGroup group)
{
var name = $"BuildSettings.{group}.Small";
if (group == BuildTargetGroup.WSA)
name = "BuildSettings.Metro.Small";
var iconContent = EditorGUIUtility.IconContent(name);
var content = new GUIContent(iconContent.image, "Select target platform for build");
return content;
}
private static void Build(bool withAutorun)
{
var options = BuildPlayerWindow.DefaultBuildMethods.GetBuildPlayerOptions(new BuildPlayerOptions());
if (withAutorun)
options.options |= BuildOptions.AutoRunPlayer;
BuildPlayerWindow.DefaultBuildMethods.BuildPlayer(options);
}
}
}
#endif

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7c4b306cf95144139c540aa7b6c0a156
timeCreated: 1765022920

View file

@ -0,0 +1,28 @@
#if UNITY_6000_3_OR_NEWER
using UnityEditor;
using UnityEditor.Toolbars;
using UnityEngine;
using UnityEngine.Scripting;
namespace Module.NavigationTool.Editor.Toolbar
{
internal static class MainToolbarPlayerPrefsElement
{
[Preserve]
[MainToolbarElement("Toolbar/Player Prefs Delete", ussName = "", defaultDockIndex = 100, defaultDockPosition = MainToolbarDockPosition.Middle, menuPriority = 1500)]
public static MainToolbarElement Draw()
{
var icon = EditorGUIUtility.IconContent("d_CacheServerDisconnected").image as Texture2D;
var content = new MainToolbarContent(icon, "Deletes all PlayerPrefs entries");
return new MainToolbarButton(content, () =>
{
if (!EditorUtility.DisplayDialog("Delete PlayerPrefs", "Are you sure you want to delete all PlayerPrefs data?", "Yes", "No"))
return;
PlayerPrefs.DeleteAll();
PlayerPrefs.Save();
});
}
}
}
#endif

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a926471f33c04f7fb75a32f84c6c9d1b
timeCreated: 1765023278

View file

@ -0,0 +1,21 @@
#if UNITY_6000_3_OR_NEWER
using UnityEditor;
using UnityEditor.Toolbars;
using UnityEngine;
using UnityEngine.Scripting;
namespace Module.NavigationTool.Editor.Toolbar
{
internal static class MainToolbarProjectSaveElement
{
[Preserve]
[MainToolbarElement("Toolbar/Project/Save", ussName = "", defaultDockIndex = 100, defaultDockPosition = MainToolbarDockPosition.Middle, menuPriority = 1500)]
public static MainToolbarElement Draw()
{
var icon = EditorGUIUtility.IconContent("Project").image as Texture2D;
var content = new MainToolbarContent(icon, "Saves all changed assets");
return new MainToolbarButton(content, AssetDatabase.SaveAssets);
}
}
}
#endif

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8383da48c39b4300b74e9c1791c32a8a
timeCreated: 1765024530

View file

@ -0,0 +1,29 @@
#if UNITY_6000_3_OR_NEWER
using UnityEditor;
using UnityEditor.Toolbars;
using UnityEngine;
using UnityEngine.Scripting;
namespace Module.NavigationTool.Editor.Toolbar
{
internal static class MainToolbarProjectSettingsElement
{
[Preserve]
[MainToolbarElement("Toolbar/Project/Open Settings", ussName = "", defaultDockIndex = 100, defaultDockPosition = MainToolbarDockPosition.Middle, menuPriority = 1500)]
public static MainToolbarElement Draw()
{
var icon = EditorGUIUtility.IconContent("Settings").image as Texture2D;
var content = new MainToolbarContent(icon, "Opens Preferences/Project Settings");
return new MainToolbarDropdown(content, OnDropdownOpen);
}
private static void OnDropdownOpen(Rect rect)
{
var menu = new GenericMenu();
menu.AddItem(new GUIContent("Preferences"), false, () => SettingsService.OpenUserPreferences("Module/Toolbar"));
menu.AddItem(new GUIContent("Project Settings"), false, () => SettingsService.OpenProjectSettings("Module/Toolbar"));
menu.DropDown(rect);
}
}
}
#endif

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5ebe021aec8e4dc58d5eb863695e3485
timeCreated: 1765024477

View file

@ -0,0 +1,187 @@
#if UNITY_6000_3_OR_NEWER
using System;
using System.Collections.Generic;
using System.Text;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEditor.Toolbars;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Scripting;
namespace Module.NavigationTool.Editor.Toolbar
{
internal static class MainToolbarScenePickerElement
{
private static readonly ScenePickerList SceneList = new();
[Preserve]
[MainToolbarElement("Toolbar/Scene", ussName = "", defaultDockIndex = 100, defaultDockPosition = MainToolbarDockPosition.Middle, menuPriority = 1500)]
public static IEnumerable<MainToolbarElement> Draw()
{
return new List<MainToolbarElement>(3)
{
CreateDropdownSceneList(),
CreateToggleSceneLoad(),
CreateButtonAddNewScene()
};
}
private static MainToolbarDropdown CreateDropdownSceneList()
{
SceneList.Refresh();
var content = new MainToolbarContent(GetSceneLabel());
return new MainToolbarDropdown(content, rect =>
{
var menu = new GenericMenu();
for (var i = 0; i < SceneList.labels.Length; i++)
{
var sceneIndex = i;
menu.AddItem(SceneList.labels[i], SceneList.selected.Contains(i), () => SelectScene(sceneIndex));
}
menu.DropDown(rect);
});
}
private static MainToolbarToggle CreateToggleSceneLoad()
{
var isScenePickerSetAsAdditive = ToolbarScenePickerSettings.IsScenePickerSetAsAdditive;
var content = isScenePickerSetAsAdditive
? new MainToolbarContent("A", "Additive scene loading (toogle to Single)")
: new MainToolbarContent("S", "Single scene loading (toggle to Additive)");
return new MainToolbarToggle(content, isScenePickerSetAsAdditive, result =>
{
ToolbarScenePickerSettings.IsScenePickerSetAsAdditive = result;
MainToolbar.Refresh("Toolbar/Scene");
});
}
private static MainToolbarButton CreateButtonAddNewScene()
{
var icon = EditorGUIUtility.IconContent("d_CreateAddNew").image as Texture2D;
var content = new MainToolbarContent(icon, "Create a new scene");
return new MainToolbarButton(content, () =>
{
try
{
var selection = EditorUtility.DisplayDialogComplex("Create new scene", "How do you want to add the scene?", "Single", "Additive", "Cancel");
if (selection == 2)
return;
var scene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, selection == 0 ? NewSceneMode.Single : NewSceneMode.Additive);
if (EditorUtility.DisplayDialog("Create new scene", "Save scene to disk?", "Yes", "No"))
EditorSceneManager.SaveScene(scene);
}
catch (Exception e)
{
EditorUtility.DisplayDialog("Failed to add scene", e.Message, "Ok");
}
});
}
private static void SelectScene(int index)
{
try
{
if (!EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
return;
var scenes = SceneList.scenes[index];
var isScenePickerSetAsAdditive = ToolbarScenePickerSettings.IsScenePickerSetAsAdditive;
for (var i = 0; i < scenes.paths.Count; i++)
{
var path = scenes.paths[i];
var scene = SceneManager.GetSceneByPath(path);
if (scenes.isGroup)
{
if (isScenePickerSetAsAdditive || i != 0)
{
EditorSceneManager.OpenScene(path, OpenSceneMode.Additive);
var sceneIndex = SceneList.IndexOfPath(path, false);
if (sceneIndex != -1)
SceneList.selected.Add(sceneIndex);
}
else
{
EditorSceneManager.OpenScene(path, OpenSceneMode.Single);
var sceneIndex = SceneList.IndexOfPath(path, false);
SceneList.selected.Clear();
if (sceneIndex != -1)
SceneList.selected.Add(index);
}
}
else
{
if (scene.isLoaded)
{
if (SceneManager.sceneCount == 1)
return;
EditorSceneManager.CloseScene(scene, true);
SceneList.selected.Remove(index);
}
else if (isScenePickerSetAsAdditive)
{
EditorSceneManager.OpenScene(path, OpenSceneMode.Additive);
SceneList.selected.Add(index);
}
else
{
EditorSceneManager.OpenScene(path, OpenSceneMode.Single);
SceneList.selected.Clear();
SceneList.selected.Add(index);
}
}
}
GetSceneLabel();
}
catch (Exception e)
{
Debug.LogException(e);
}
finally
{
MainToolbar.Refresh("Toolbar/Scene");
}
}
private static string GetSceneLabel()
{
var builder = new StringBuilder();
if (SceneList.selected.Count != 0)
{
for (var i = 0; i < SceneList.selected.Count; i++)
{
if (i > 0)
builder.Append(", ");
builder.Append(SceneList.scenes[SceneList.selected[i]].shortname);
}
}
else
{
builder.Append("Unsaved scene(s)");
}
return builder.ToString();
}
public static void Refresh()
{
MainToolbar.Refresh("Toolbar/Scene");
}
}
}
#endif

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 279f6b5a4bce42b6b1250f13a31a065c
timeCreated: 1765023392

View file

@ -0,0 +1,30 @@
#if UNITY_6000_3_OR_NEWER
using UnityEditor.Toolbars;
using UnityEngine;
using UnityEngine.Scripting;
namespace Module.NavigationTool.Editor.Toolbar
{
internal static class MainToolbarTimeScaleElement
{
[Preserve]
[MainToolbarElement("Toolbar/Time Scale", ussName = "", defaultDockIndex = 0, defaultDockPosition = MainToolbarDockPosition.Middle, menuPriority = 500)]
public static MainToolbarElement Draw()
{
var content = new MainToolbarContent("Time:", "Adjust Time.timeScale from [min;max] and snaps when value is approximately 1.0");
return new MainToolbarSlider(content, Time.timeScale, ToolbarTimeSettings.TimeScaleMinValue, ToolbarTimeSettings.TimeScaleMaxValue, OnTimeScaleValueChanged);
}
private static void OnTimeScaleValueChanged(float value)
{
value = Mathf.Clamp(value, ToolbarTimeSettings.TimeScaleMinValue, ToolbarTimeSettings.TimeScaleMaxValue);
if (Mathf.Abs(value - 1.0f) < 0.02f)
value = 1.0f;
if (!Mathf.Approximately(Time.timeScale, value))
Time.timeScale = value;
}
}
}
#endif

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 86d04559b6fc4260b33c97799a0e78e6
timeCreated: 1765023773

View file

@ -0,0 +1,99 @@
#if UNITY_6000_3_OR_NEWER
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEditor.Toolbars;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Scripting;
using UTools = UnityEditor.Tools;
namespace Module.NavigationTool.Editor.Toolbar
{
internal static class MainToolbarUIElement
{
[Preserve]
[MainToolbarElement("Toolbar/UI", ussName = "", defaultDockIndex = 0, defaultDockPosition = MainToolbarDockPosition.Middle, menuPriority = 500)]
public static IEnumerable<MainToolbarElement> Draw()
{
var layer = 1 << LayerMask.NameToLayer("UI");
var toggleValue = (UTools.visibleLayers & layer) != 0;
return new List<MainToolbarElement>(2)
{
new MainToolbarToggle(new MainToolbarContent("UI", "Toggles UI visible layer in SceneView"), toggleValue, OnToggleValueChanged),
new MainToolbarDropdown(new MainToolbarContent("Select"), OnDropdownOpen)
};
}
private static void OnToggleValueChanged(bool result)
{
var layer = 1 << LayerMask.NameToLayer("UI");
if (result)
UTools.visibleLayers |= layer;
else
UTools.visibleLayers &= ~layer;
SceneView.RepaintAll();
}
private static void OnDropdownOpen(Rect rect)
{
var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
var canvases = prefabStage != null
? prefabStage.prefabContentsRoot.GetComponentsInParent<Canvas>()
: Object.FindObjectsByType<Canvas>(FindObjectsInactive.Include, FindObjectsSortMode.InstanceID);
var list = new List<Canvas>(canvases.Length);
var menu = new GenericMenu();
for (var i = 0; i < canvases.Length; i++)
{
var root = canvases[i].rootCanvas;
if (list.Contains(root))
continue;
list.Add(root);
menu.AddItem(new GUIContent($"{i}: {root.name}"), false, () => Focus(root.GetInstanceID()));
}
menu.DropDown(rect);
}
private static void Focus(int instanceId)
{
var obj = EditorUtility.EntityIdToObject(instanceId);
var canvas = obj as Canvas;
if (canvas == null)
{
if (obj != null)
Debug.LogWarning("Failed to find Canvas component on object", obj);
return;
}
Selection.activeObject = canvas;
var bounds = InternalEditorUtility.CalculateSelectionBounds(false, true, true);
var point = bounds.center;
var direction = canvas.transform.rotation;
var size = Mathf.Max(bounds.extents.x, bounds.extents.y);
var ortho = canvas.renderMode == RenderMode.ScreenSpaceOverlay;
for (var i = 0; i < SceneView.sceneViews.Count; i++)
{
var view = (SceneView)SceneView.sceneViews[i];
view.in2DMode = false;
view.LookAt(point, direction, size, ortho, false);
}
}
public static void Refresh()
{
MainToolbar.Refresh("Toolbar/UI");
}
}
}
#endif

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c070302f00e44ad6b6a383ae07de6fe2
timeCreated: 1765024213

View file

@ -4,6 +4,10 @@
{ {
string Title { get; } string Title { get; }
#if UNITY_6000_3_OR_NEWER
bool EnableDraw { get; }
#endif
void Initialize(); void Initialize();
void Draw(); void Draw();
} }

View file

@ -52,6 +52,11 @@ namespace Module.NavigationTool.Editor.Toolbar
try try
{ {
#if UNITY_6000_3_OR_NEWER
if (!settings.EnableDraw)
continue;
#endif
bool foldoutState = GetFoldoutState(settings); bool foldoutState = GetFoldoutState(settings);
bool newFoldoutState = EditorGUILayout.BeginFoldoutHeaderGroup(foldoutState, settings.Title, EditorStyles.foldoutHeader); bool newFoldoutState = EditorGUILayout.BeginFoldoutHeaderGroup(foldoutState, settings.Title, EditorStyles.foldoutHeader);

View file

@ -1,4 +1,5 @@
using UnityEditor; #if !UNITY_6000_3_OR_NEWER
using UnityEditor;
using UnityEngine; using UnityEngine;
#if UNITY_2021_1_OR_NEWER #if UNITY_2021_1_OR_NEWER
@ -180,3 +181,4 @@ namespace Module.NavigationTool.Editor.Toolbar
#endif #endif
} }
} }
#endif

View file

@ -6,14 +6,23 @@ namespace Module.NavigationTool.Editor.Toolbar
{ {
public string Title => "Build"; public string Title => "Build";
#if !UNITY_6000_3_OR_NEWER
private const string PREF_IS_BUILD_ENABLED = "ToolbarSettings.IsBuildEnabled"; private const string PREF_IS_BUILD_ENABLED = "ToolbarSettings.IsBuildEnabled";
#endif
private const string PREF_IS_BUILD_AND_RUN_ENABLED = "ToolbarSettings.IsBuildAndRunEnabled"; private const string PREF_IS_BUILD_AND_RUN_ENABLED = "ToolbarSettings.IsBuildAndRunEnabled";
#if UNITY_6000_3_OR_NEWER
public bool EnableDraw => false;
#endif
#if !UNITY_6000_3_OR_NEWER
public static bool IsBuildEnabled public static bool IsBuildEnabled
{ {
get => EditorPrefs.GetBool(PREF_IS_BUILD_ENABLED, false); get => EditorPrefs.GetBool(PREF_IS_BUILD_ENABLED, false);
set => EditorPrefs.SetBool(PREF_IS_BUILD_ENABLED, value); set => EditorPrefs.SetBool(PREF_IS_BUILD_ENABLED, value);
} }
#endif
public static bool IsBuildAndRunEnabled public static bool IsBuildAndRunEnabled
{ {
@ -27,7 +36,9 @@ namespace Module.NavigationTool.Editor.Toolbar
public void Draw() public void Draw()
{ {
#if !UNITY_6000_3_OR_NEWER
IsBuildEnabled = EditorGUILayout.Toggle("Enable Build Target", IsBuildEnabled); IsBuildEnabled = EditorGUILayout.Toggle("Enable Build Target", IsBuildEnabled);
#endif
} }
} }
} }

View file

@ -1,4 +1,5 @@
using UnityEditor; #if !UNITY_6000_3_OR_NEWER
using UnityEditor;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
@ -24,3 +25,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -18,7 +18,12 @@ namespace Module.NavigationTool.Editor.Toolbar
settings = projectSettings.GetValueAs<Settings>(); settings = projectSettings.GetValueAs<Settings>();
sceneGroupList = new SceneGroupReorderableListDrawer(settings.sceneGroups.groups, "Scene groups"); sceneGroupList = new SceneGroupReorderableListDrawer(settings.sceneGroups.groups, "Scene groups");
#if UNITY_6000_3_OR_NEWER
sceneGroupList.onChanged += MainToolbarScenePickerElement.Refresh;
#else
sceneGroupList.onChanged += ToolScenePicker.SetAsDirty; sceneGroupList.onChanged += ToolScenePicker.SetAsDirty;
#endif
} }
public void Draw() public void Draw()

View file

@ -6,14 +6,23 @@ namespace Module.NavigationTool.Editor.Toolbar
{ {
public string Title => "Scene"; public string Title => "Scene";
#if !UNITY_6000_3_OR_NEWER
private const string PREF_IS_SCENE_ENABLED = "ToolbarSettings_IsSceneEnabled"; private const string PREF_IS_SCENE_ENABLED = "ToolbarSettings_IsSceneEnabled";
#endif
private const string PREF_SCENE_PICKER_LOAD_SET_AS_ADDITIVE_KEY = "ToolbarSettings_ScenePickerLoadSetAsAdditive"; private const string PREF_SCENE_PICKER_LOAD_SET_AS_ADDITIVE_KEY = "ToolbarSettings_ScenePickerLoadSetAsAdditive";
#if UNITY_6000_3_OR_NEWER
public bool EnableDraw => false;
#endif
#if !UNITY_6000_3_OR_NEWER
public static bool IsSceneEnabled public static bool IsSceneEnabled
{ {
get => EditorPrefs.GetBool(PREF_IS_SCENE_ENABLED, true); get => EditorPrefs.GetBool(PREF_IS_SCENE_ENABLED, true);
private set => EditorPrefs.SetBool(PREF_IS_SCENE_ENABLED, value); private set => EditorPrefs.SetBool(PREF_IS_SCENE_ENABLED, value);
} }
#endif
public static bool IsScenePickerSetAsAdditive public static bool IsScenePickerSetAsAdditive
{ {
@ -27,7 +36,9 @@ namespace Module.NavigationTool.Editor.Toolbar
public void Draw() public void Draw()
{ {
#if !UNITY_6000_3_OR_NEWER
IsSceneEnabled = EditorGUILayout.Toggle("Enable Scene picker", IsSceneEnabled); IsSceneEnabled = EditorGUILayout.Toggle("Enable Scene picker", IsSceneEnabled);
#endif
} }
} }
} }

View file

@ -1,4 +1,5 @@
using UnityEditor; #if !UNITY_6000_3_OR_NEWER
using UnityEditor;
using UnityEngine; using UnityEngine;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
@ -7,15 +8,24 @@ namespace Module.NavigationTool.Editor.Toolbar
{ {
public string Title => "Target Frame Rate"; public string Title => "Target Frame Rate";
#if !UNITY_6000_3_OR_NEWER
private const string PREF_IS_TARGET_FRAME_RATE_ENABLED = "ToolbarSettings.IsTargetFrameRateEnabled"; private const string PREF_IS_TARGET_FRAME_RATE_ENABLED = "ToolbarSettings.IsTargetFrameRateEnabled";
#endif
private const string PREF_TARGET_FRAME_RATE_MIN = "ToolbarSettings.TargetFrameRateMin"; private const string PREF_TARGET_FRAME_RATE_MIN = "ToolbarSettings.TargetFrameRateMin";
private const string PREF_TARGET_FRAME_RATE_MAX = "ToolbarSettings.TargetFrameRateMax"; private const string PREF_TARGET_FRAME_RATE_MAX = "ToolbarSettings.TargetFrameRateMax";
#if UNITY_6000_3_OR_NEWER
public bool EnableDraw => true;
#endif
#if !UNITY_6000_3_OR_NEWER
public static bool IsTargetFrameRateEnabled public static bool IsTargetFrameRateEnabled
{ {
get => EditorPrefs.GetBool(PREF_IS_TARGET_FRAME_RATE_ENABLED, false); get => EditorPrefs.GetBool(PREF_IS_TARGET_FRAME_RATE_ENABLED, false);
set => EditorPrefs.SetBool(PREF_IS_TARGET_FRAME_RATE_ENABLED, value); set => EditorPrefs.SetBool(PREF_IS_TARGET_FRAME_RATE_ENABLED, value);
} }
#endif
public static int TargetFrameRateMinValue public static int TargetFrameRateMinValue
{ {
@ -35,9 +45,11 @@ namespace Module.NavigationTool.Editor.Toolbar
public void Draw() public void Draw()
{ {
#if !UNITY_6000_3_OR_NEWER
IsTargetFrameRateEnabled = EditorGUILayout.Toggle("Enable Frame Rate", IsTargetFrameRateEnabled); IsTargetFrameRateEnabled = EditorGUILayout.Toggle("Enable Frame Rate", IsTargetFrameRateEnabled);
GUI.enabled = IsTargetFrameRateEnabled; GUI.enabled = IsTargetFrameRateEnabled;
#endif
int minValue = EditorGUILayout.IntField("Min", TargetFrameRateMinValue); int minValue = EditorGUILayout.IntField("Min", TargetFrameRateMinValue);
int maxValue = EditorGUILayout.IntField("Max", TargetFrameRateMaxValue); int maxValue = EditorGUILayout.IntField("Max", TargetFrameRateMaxValue);
@ -64,3 +76,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -7,15 +7,24 @@ namespace Module.NavigationTool.Editor.Toolbar
{ {
public string Title => "Time"; public string Title => "Time";
#if !UNITY_6000_3_OR_NEWER
private const string PREF_IS_TIME_SCALE_ENABLED = "ToolbarSettings.IsTimeScaleEnabled"; private const string PREF_IS_TIME_SCALE_ENABLED = "ToolbarSettings.IsTimeScaleEnabled";
#endif
private const string PREF_TIME_SCALE_MIN = "ToolbarSettings.TimeScaleMin"; private const string PREF_TIME_SCALE_MIN = "ToolbarSettings.TimeScaleMin";
private const string PREF_TIME_SCALE_MAX = "ToolbarSettings.TimeScaleMax"; private const string PREF_TIME_SCALE_MAX = "ToolbarSettings.TimeScaleMax";
#if UNITY_6000_3_OR_NEWER
public bool EnableDraw => true;
#endif
#if !UNITY_6000_3_OR_NEWER
public static bool IsTimeScaleEnabled public static bool IsTimeScaleEnabled
{ {
get => EditorPrefs.GetBool(PREF_IS_TIME_SCALE_ENABLED, false); get => EditorPrefs.GetBool(PREF_IS_TIME_SCALE_ENABLED, false);
set => EditorPrefs.SetBool(PREF_IS_TIME_SCALE_ENABLED, value); set => EditorPrefs.SetBool(PREF_IS_TIME_SCALE_ENABLED, value);
} }
#endif
public static float TimeScaleMinValue public static float TimeScaleMinValue
{ {
@ -35,9 +44,11 @@ namespace Module.NavigationTool.Editor.Toolbar
public void Draw() public void Draw()
{ {
#if !UNITY_6000_3_OR_NEWER
IsTimeScaleEnabled = EditorGUILayout.Toggle("Enable Time slider", IsTimeScaleEnabled); IsTimeScaleEnabled = EditorGUILayout.Toggle("Enable Time slider", IsTimeScaleEnabled);
GUI.enabled = IsTimeScaleEnabled; GUI.enabled = IsTimeScaleEnabled;
#endif
float timeScaleMinValue = EditorGUILayout.FloatField("Min Value", TimeScaleMinValue); float timeScaleMinValue = EditorGUILayout.FloatField("Min Value", TimeScaleMinValue);
float timeScaleMaxValue = EditorGUILayout.FloatField("Max Value", TimeScaleMaxValue); float timeScaleMaxValue = EditorGUILayout.FloatField("Max Value", TimeScaleMaxValue);

View file

@ -1,4 +1,5 @@
using UnityEditor; #if !UNITY_6000_3_OR_NEWER
using UnityEditor;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
@ -32,3 +33,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,4 +1,5 @@
using UnityEditor; #if !UNITY_6000_3_OR_NEWER
using UnityEditor;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
@ -32,3 +33,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,11 +1,10 @@
using JetBrains.Annotations; #if !UNITY_6000_3_OR_NEWER
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UTools = UnityEditor.Tools; using UTools = UnityEditor.Tools;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
[UsedImplicitly]
internal sealed class ToolBuild : AbstractToolbarDrawer internal sealed class ToolBuild : AbstractToolbarDrawer
{ {
public override bool Visible => ToolbarBuildSettings.IsBuildEnabled; public override bool Visible => ToolbarBuildSettings.IsBuildEnabled;
@ -81,3 +80,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,14 +1,13 @@
using System; #if !UNITY_6000_3_OR_NEWER
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using JetBrains.Annotations;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UTools = UnityEditor.Tools; using UTools = UnityEditor.Tools;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
[UsedImplicitly]
internal sealed class ToolBuildTargetPicker : AbstractToolbarDrawer internal sealed class ToolBuildTargetPicker : AbstractToolbarDrawer
{ {
public override bool Visible => ToolbarBuildSettings.IsBuildEnabled; public override bool Visible => ToolbarBuildSettings.IsBuildEnabled;
@ -146,3 +145,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,10 +1,9 @@
using JetBrains.Annotations; #if !UNITY_6000_3_OR_NEWER
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
[UsedImplicitly]
internal sealed class ToolPlayerPrefs : AbstractToolbarDrawer internal sealed class ToolPlayerPrefs : AbstractToolbarDrawer
{ {
public override bool Visible => ToolbarPlayerPrefsSettings.IsPlayerPrefsEnabled; public override bool Visible => ToolbarPlayerPrefsSettings.IsPlayerPrefsEnabled;
@ -34,3 +33,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,6 +1,6 @@
using System; #if !UNITY_6000_3_OR_NEWER
using System;
using System.Text; using System.Text;
using JetBrains.Annotations;
using UnityEditor; using UnityEditor;
using UnityEditor.SceneManagement; using UnityEditor.SceneManagement;
using UnityEngine; using UnityEngine;
@ -8,7 +8,6 @@ using UnityEngine.SceneManagement;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
[UsedImplicitly]
internal sealed class ToolScenePicker : AbstractToolbarDrawer internal sealed class ToolScenePicker : AbstractToolbarDrawer
{ {
public override bool Visible => ToolbarScenePickerSettings.IsSceneEnabled; public override bool Visible => ToolbarScenePickerSettings.IsSceneEnabled;
@ -231,3 +230,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,4 +1,5 @@
using UnityEditor; #if !UNITY_6000_3_OR_NEWER
using UnityEditor;
using UnityEditor.SceneManagement; using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
@ -60,3 +61,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,4 +1,5 @@
using System.Linq; #if !UNITY_6000_3_OR_NEWER
using System.Linq;
using UnityEditor; using UnityEditor;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
@ -18,3 +19,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,11 +1,10 @@
using JetBrains.Annotations; #if !UNITY_6000_3_OR_NEWER
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UTools = UnityEditor.Tools; using UTools = UnityEditor.Tools;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
[UsedImplicitly]
internal sealed class ToolTargetFrameRate : AbstractToolbarDrawer internal sealed class ToolTargetFrameRate : AbstractToolbarDrawer
{ {
public override bool Visible => ToolbarTargetFrameRateSettings.IsTargetFrameRateEnabled; public override bool Visible => ToolbarTargetFrameRateSettings.IsTargetFrameRateEnabled;
@ -43,3 +42,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,11 +1,10 @@
using JetBrains.Annotations; #if !UNITY_6000_3_OR_NEWER
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UTools = UnityEditor.Tools; using UTools = UnityEditor.Tools;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
[UsedImplicitly]
internal sealed class ToolTimeScale : AbstractToolbarDrawer internal sealed class ToolTimeScale : AbstractToolbarDrawer
{ {
public override bool Visible => ToolbarTimeSettings.IsTimeScaleEnabled; public override bool Visible => ToolbarTimeSettings.IsTimeScaleEnabled;
@ -54,3 +53,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,5 +1,5 @@
using System.Collections.Generic; #if !UNITY_6000_3_OR_NEWER
using JetBrains.Annotations; using System.Collections.Generic;
using UnityEditor; using UnityEditor;
using UnityEditorInternal; using UnityEditorInternal;
using UnityEngine; using UnityEngine;
@ -13,7 +13,6 @@ using UnityEditor.Experimental.SceneManagement;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
[UsedImplicitly]
internal sealed class ToolUICanvasPicker : AbstractToolbarDrawer internal sealed class ToolUICanvasPicker : AbstractToolbarDrawer
{ {
public override bool Visible => ToolbarUiSettings.IsUiEnabled; public override bool Visible => ToolbarUiSettings.IsUiEnabled;
@ -130,3 +129,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,4 +1,5 @@
using UnityEditor; #if !UNITY_6000_3_OR_NEWER
using UnityEditor;
using UnityEditor.Experimental.SceneManagement; using UnityEditor.Experimental.SceneManagement;
using UnityEditor.SceneManagement; using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
@ -44,3 +45,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,11 +1,10 @@
using JetBrains.Annotations; #if !UNITY_6000_3_OR_NEWER
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UTools = UnityEditor.Tools; using UTools = UnityEditor.Tools;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
[UsedImplicitly]
internal sealed class ToolUILayerToggle : AbstractToolbarDrawer internal sealed class ToolUILayerToggle : AbstractToolbarDrawer
{ {
public override bool Visible => ToolbarUiSettings.IsUiLayerEnabled; public override bool Visible => ToolbarUiSettings.IsUiLayerEnabled;
@ -44,3 +43,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,11 +1,10 @@
using JetBrains.Annotations; #if !UNITY_6000_3_OR_NEWER
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UTools = UnityEditor.Tools; using UTools = UnityEditor.Tools;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
[UsedImplicitly]
internal sealed class ToolUnityProjectOpenSettings : AbstractToolbarDrawer internal sealed class ToolUnityProjectOpenSettings : AbstractToolbarDrawer
{ {
public override bool Visible => ToolbarUnitySettings.IsProjectSettingsEnabled; public override bool Visible => ToolbarUnitySettings.IsProjectSettingsEnabled;
@ -37,3 +36,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,11 +1,10 @@
using JetBrains.Annotations; #if !UNITY_6000_3_OR_NEWER
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UTools = UnityEditor.Tools; using UTools = UnityEditor.Tools;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
[UsedImplicitly]
internal sealed class ToolUnityProjectSave : AbstractToolbarDrawer internal sealed class ToolUnityProjectSave : AbstractToolbarDrawer
{ {
public override bool Visible => ToolbarUnitySettings.IsProjectSaveEnabled; public override bool Visible => ToolbarUnitySettings.IsProjectSaveEnabled;
@ -30,3 +29,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,19 +1,25 @@
using UnityEditor; #if !UNITY_6000_3_OR_NEWER
using UnityEditor;
#endif
using UnityEngine; using UnityEngine;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
public sealed class Styles public sealed class Styles
{ {
#if !UNITY_6000_3_OR_NEWER
public GUIStyle popup; public GUIStyle popup;
public GUIStyle button; public GUIStyle button;
public GUIStyle buttonNoPadding; public GUIStyle buttonNoPadding;
public GUIStyle slider; public GUIStyle slider;
public GUIStyle label; public GUIStyle label;
public GUIStyle labelCenter; public GUIStyle labelCenter;
public GUIStyle settingsGroup;
public GUIStyle centeredMiniLabel; public GUIStyle centeredMiniLabel;
#endif
public GUIStyle settingsGroup;
#if !UNITY_6000_3_OR_NEWER
public GUIContent iconPlusSmall; public GUIContent iconPlusSmall;
#if !UNITY_6000_0_OR_NEWER #if !UNITY_6000_0_OR_NEWER
public GUIContent iconSceneAdditive; public GUIContent iconSceneAdditive;
@ -22,6 +28,7 @@ namespace Module.NavigationTool.Editor.Toolbar
public GUIContent iconDisconnect; public GUIContent iconDisconnect;
public GUIContent iconProject; public GUIContent iconProject;
public GUIContent iconSettings; public GUIContent iconSettings;
#endif
private GUISkin skin; private GUISkin skin;
@ -31,6 +38,8 @@ namespace Module.NavigationTool.Editor.Toolbar
return; return;
this.skin = skin; this.skin = skin;
#if !UNITY_6000_3_OR_NEWER
popup = new GUIStyle(skin.FindStyle("ToolbarPopup")); popup = new GUIStyle(skin.FindStyle("ToolbarPopup"));
button = new GUIStyle(skin.FindStyle("toolbarbutton")); button = new GUIStyle(skin.FindStyle("toolbarbutton"));
slider = new GUIStyle(skin.FindStyle("ToolbarSlider")); slider = new GUIStyle(skin.FindStyle("ToolbarSlider"));
@ -55,12 +64,14 @@ namespace Module.NavigationTool.Editor.Toolbar
{ {
alignment = TextAnchor.MiddleCenter alignment = TextAnchor.MiddleCenter
}; };
#endif
settingsGroup = new GUIStyle settingsGroup = new GUIStyle
{ {
margin = new RectOffset(8, 0, 8, 0) margin = new RectOffset(8, 0, 8, 0)
}; };
#if !UNITY_6000_3_OR_NEWER
if (EditorGUIUtility.isProSkin) if (EditorGUIUtility.isProSkin)
{ {
iconPlusSmall = EditorGUIUtility.IconContent("d_CreateAddNew"); iconPlusSmall = EditorGUIUtility.IconContent("d_CreateAddNew");
@ -83,6 +94,7 @@ namespace Module.NavigationTool.Editor.Toolbar
iconDisconnect = EditorGUIUtility.IconContent("d_CacheServerDisconnected"); iconDisconnect = EditorGUIUtility.IconContent("d_CacheServerDisconnected");
iconProject = EditorGUIUtility.IconContent("Project"); iconProject = EditorGUIUtility.IconContent("Project");
iconSettings = new GUIContent(EditorGUIUtility.IconContent("Settings")); iconSettings = new GUIContent(EditorGUIUtility.IconContent("Settings"));
#endif
} }
} }
} }

View file

@ -1,4 +1,5 @@
using System; #if !UNITY_6000_3_OR_NEWER
using System;
using UnityEngine.UIElements; using UnityEngine.UIElements;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
@ -14,3 +15,4 @@ namespace Module.NavigationTool.Editor.Toolbar
} }
} }
} }
#endif

View file

@ -1,4 +1,5 @@
using System; #if !UNITY_6000_3_OR_NEWER
using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using System.Reflection; using System.Reflection;
@ -235,3 +236,4 @@ namespace Module.NavigationTool.Editor.Toolbar
#endif #endif
} }
} }
#endif

View file

@ -1,6 +1,6 @@
{ {
"name": "com.module.navigationtool", "name": "com.module.navigationtool",
"version": "1.11.4", "version": "2.0.0",
"displayName": "Module.NavigationTool", "displayName": "Module.NavigationTool",
"description": "Support for navigation tools, like favorites, history and toolbars", "description": "Support for navigation tools, like favorites, history and toolbars",
"unity": "2019.2", "unity": "2019.2",