修复结算界面返回主界面的BUG

This commit is contained in:
2026-07-05 03:24:39 +08:00
parent 1e820b823a
commit aa9482875c
3 changed files with 118 additions and 156 deletions
+17
View File
@@ -167,6 +167,23 @@ namespace GameFramework
// 显示鼠标
Cursor.visible = true;
Cursor.lockState = CursorLockMode.None;
// 确保 EventSystem 有输入模块(UI 点击必需)
EnsureEventSystemInputModule();
}
/// <summary>
/// 确保 EventSystem 有 StandaloneInputModule,否则 UI 按钮无法响应点击。
/// </summary>
private void EnsureEventSystemInputModule()
{
var es = UnityEngine.EventSystems.EventSystem.current;
if (es == null) return;
if (es.GetComponent<UnityEngine.EventSystems.StandaloneInputModule>() == null)
{
es.gameObject.AddComponent<UnityEngine.EventSystems.StandaloneInputModule>();
Debug.Log("[GameLostOverlay] 已自动添加 StandaloneInputModule");
}
}
/// <summary>