Unity 关闭App, 再启动App, 闪退

it2025-11-13  9

问题描述:

App关闭后,再次点击启动App,出现闪退的情况。

原因分析:

错误提示 Unity: Timeout while trying detaching primary window.

解决方案:

System.Diagnostics.Process.GetCurrentProcess().Kill();

或者

public void OnExitBtnClick() { System.Diagnostics.Process.GetCurrentProcess().Exited += new EventHandler(exep_Exited); System.Diagnostics.Process.GetCurrentProcess().CloseMainWindow(); System.Diagnostics.Process.GetCurrentProcess().Close(); } void exep_Exited(object sender, EventArgs e) { Debug.LogError("CloseMainWindow"); }
最新回复(0)