using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; using UnityEngine.UI; public class UIUtility { [UnityEditor.MenuItem("Assets/PSDTOUGUI后处理")] public static void BaseSettings() { GameObject go = Selection.activeGameObject; if (go == null) { return; } // go.AddMissingComponent(); // go.AddMissingComponent(); // go.AddMissingComponent(); } [UnityEditor.MenuItem("Assets/新UI处理")] public static void NewUIHandle() { GameObject go = Selection.activeGameObject; if (go == null) { return; } if (!go.name.EndsWith("Win")) { Debug.LogError("请选择正确的UI UI应该以Win结尾"); return; } go.AddMissingComponent(); go.AddMissingComponent(); go.AddMissingComponent(); var graphics = go.GetComponentsInChildren(true); foreach (Graphic g in graphics) { g.raycastTarget = false; } } }