Skip to content

Commit

Permalink
fix: Fixed error when executing menu item
Browse files Browse the repository at this point in the history
Close #27
  • Loading branch information
Haruma-K authored and mob-sakai committed Mar 14, 2023
1 parent 0a70db8 commit 9f0afa1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Scripts/Editor/MenuOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ internal class MenuOptions_UIUnmask
[MenuItem("GameObject/UI/Unmask/Tutorial Button")]
private static void CreateTutorialButton2(MenuCommand menuCommand)
{
EditorApplication.ExecuteMenuItem("GameObject/UI/Button");
#if UNITY_2021_2_OR_NEWER
const string menuItemName = "GameObject/UI/Legacy/Button";
#else
const string menuItemName = "GameObject/UI/Button";
#endif
EditorApplication.ExecuteMenuItem(menuItemName);
var button = Selection.activeGameObject.GetComponent<Button>();
button.name = "Tutorial Button";

Expand Down

0 comments on commit 9f0afa1

Please sign in to comment.