Skip to content
  • Sponsor litefeel/Unity-AlignTools

  • Notifications You must be signed in to change notification settings
  • Fork 26

Commit 5d8e83a

Browse files
committedMay 2, 2019
Support unity 2019 and change menu path
1 parent 668c497 commit 5d8e83a

3 files changed

+43
-3
lines changed
 

‎Editor/AlignToolsMenu.cs

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,37 @@
11
using UnityEditor;
2+
#if UNITY_2019_1_OR_NEWER
3+
using UnityEditor.ShortcutManagement;
4+
using UnityEngine;
5+
#endif
26

37
namespace litefeel.AlignTools
48
{
59
public static class AlignToolsMenu
610
{
7-
private const string KeyboardMenuPath = "Window/Align Tools/Adjust Position By Keyboard %#K";
8-
11+
#if UNITY_2019_1_OR_NEWER
12+
private const string KeyboardMenuPath = "Align Tools/Adjust Position By Keyboard";
13+
private const string WindowMenuPath = "Window/LiteFeel/Align Tools";
14+
#else
15+
private const string KeyboardMenuPath = "Window/LiteFeel/Align Tools/Adjust Position By Keyboard %#K";
16+
private const string WindowMenuPath = "Window/LiteFeel/Align Tools/Align Tools";
17+
#endif
918
// Creation of window
10-
[MenuItem("Window/Align Tools/Align Tools")]
19+
[MenuItem(WindowMenuPath)]
1120
private static void AlignToolsWindows()
1221
{
1322
AlignToolsWindow window = EditorWindow.GetWindow<AlignToolsWindow>(false, "Align Tools", true);
1423
window.Show();
1524
window.autoRepaintOnSceneChange = true;
1625
}
1726

27+
#if UNITY_2019_1_OR_NEWER
28+
[ClutchShortcut(KeyboardMenuPath, KeyCode.K, ShortcutModifiers.Action | ShortcutModifiers.Shift)]
29+
private static void ToggleKeyboard(ShortcutArguments arg)
30+
{
31+
if (arg.stage == ShortcutStage.Begin)
32+
Settings.AdjustPositionByKeyboard = !Settings.AdjustPositionByKeyboard;
33+
}
34+
#else
1835
[MenuItem(KeyboardMenuPath, true)]
1936
private static bool VaildToggleKeyboard()
2037
{
@@ -26,6 +43,7 @@ private static void ToggleKeyboard()
2643
{
2744
Settings.AdjustPositionByKeyboard = !Menu.GetChecked(KeyboardMenuPath);
2845
}
46+
#endif
2947
}
3048
}
3149

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "Unity.com.litefeel.aligntools.Editor",
3+
"references": [],
4+
"optionalUnityReferences": [],
5+
"includePlatforms": [
6+
"Editor"
7+
],
8+
"excludePlatforms": [],
9+
"allowUnsafeCode": false,
10+
"overrideReferences": false,
11+
"precompiledReferences": [],
12+
"autoReferenced": true,
13+
"defineConstraints": [],
14+
"versionDefines": []
15+
}

‎Editor/Unity.com.litefeel.aligntools.Editor.asmdef.meta

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.