修复结算界面返回主界面的BUG
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user