| | |
| | | // go.AddMissingComponent<Canvas>();
|
| | | // go.AddMissingComponent<Canvas>();
|
| | | }
|
| | |
|
| | | [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<Canvas>();
|
| | | go.AddMissingComponent<CanvasGroup>();
|
| | | go.AddMissingComponent<CanvasScaler>();
|
| | |
|
| | | var graphics = go.GetComponentsInChildren<Graphic>(true);
|
| | |
|
| | | foreach (Graphic g in graphics)
|
| | | {
|
| | | g.raycastTarget = false;
|
| | | }
|
| | | }
|
| | | } |