diff --git a/Assets/TEngine/Scripts/Runtime/UIModule/Scripts/Mgr/UIManager.cs b/Assets/TEngine/Scripts/Runtime/UIModule/Scripts/Mgr/UIManager.cs index 9d186562..78212592 100644 --- a/Assets/TEngine/Scripts/Runtime/UIModule/Scripts/Mgr/UIManager.cs +++ b/Assets/TEngine/Scripts/Runtime/UIModule/Scripts/Mgr/UIManager.cs @@ -253,6 +253,33 @@ namespace TEngine.Runtime.UIModule ResortStackUI(windowStack, resortIndex); ShowTopUI(windowStack); + CheckGraphicRaycaster(window); + } + + private void CheckGraphicRaycaster(UIWindow window) + { + if (window == null) + { + Log.Fatal($" UIWindow Is NUll"); + return; + } + + if (window.gameObject == null) + { + Log.Fatal($" UIWindow's gameObject Is NUll"); + return; + } + + var listCanvas = window.gameObject.GetComponentsInChildren(true); + for (int i = 0; i < listCanvas.Length; i++) + { + var childCanvas = listCanvas[i]; + GraphicRaycaster graphicRaycaster; + if (!childCanvas.gameObject.TryGetComponent(out graphicRaycaster)) + { + graphicRaycaster = childCanvas.gameObject.AddComponent(); + } + } } private void ResortStackUI(UIWindowStack stack, int startIdx)