问题描述:
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");
}
本文探讨了App在启动时频繁闪退的问题,主要表现为Unity给出的'Timeoutwhiletryingdetachingprimarywindow'错误。提供了两种可能的解决方案,包括强制结束进程和处理退出事件,帮助开发者定位并修复此问题。
1万+





