From 34588b6e5cfb3f49b028beee0e094d1ca6f61d37 Mon Sep 17 00:00:00 2001 From: tako Date: Tue, 21 Apr 2026 10:47:25 +0900 Subject: [PATCH] fix: updated support for some changed menu paths close #397 --- Editor/UIParticleMenu.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Editor/UIParticleMenu.cs b/Editor/UIParticleMenu.cs index 256a4f9..283c9ef 100644 --- a/Editor/UIParticleMenu.cs +++ b/Editor/UIParticleMenu.cs @@ -6,11 +6,22 @@ namespace Coffee.UIExtensions { internal class UIParticleMenu { - [MenuItem("GameObject/UI/Particle System (Empty)", false, 2018)] +#if UNITY_6000_5_OR_NEWER + private const string k_MenuPathToCreateParticleSystem = "GameObject/Visual Effects/Particle System"; +#else + private const string k_MenuPathToCreateParticleSystem = "GameObject/Effects/Particle System"; +#endif +#if UNITY_6000_3_OR_NEWER + private const string k_MenuPathForUgui = "GameObject/UI (Canvas)"; +#else + private const string k_MenuPathForUgui = "GameObject/UI"; +#endif + + [MenuItem(k_MenuPathForUgui + "/Particle System (Empty)", false, 2018)] private static void AddParticleEmpty(MenuCommand menuCommand) { // Create empty UI element. - EditorApplication.ExecuteMenuItem("GameObject/UI/Image"); + EditorApplication.ExecuteMenuItem(k_MenuPathForUgui + "/Image"); var ui = Selection.activeGameObject; Object.DestroyImmediate(ui.GetComponent()); @@ -21,7 +32,7 @@ namespace Coffee.UIExtensions uiParticle.rectTransform.sizeDelta = Vector2.zero; } - [MenuItem("GameObject/UI/Particle System", false, 2019)] + [MenuItem(k_MenuPathForUgui + "/Particle System", false, 2019)] private static void AddParticle(MenuCommand menuCommand) { // Create empty UIEffect. @@ -29,7 +40,7 @@ namespace Coffee.UIExtensions var uiParticle = Selection.activeGameObject.GetComponent(); // Create ParticleSystem. - EditorApplication.ExecuteMenuItem("GameObject/Effects/Particle System"); + EditorApplication.ExecuteMenuItem(k_MenuPathToCreateParticleSystem); var ps = Selection.activeGameObject; ps.transform.SetParent(uiParticle.transform, false); ps.transform.localPosition = Vector3.zero;