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

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