Hi, I have the following code:
void StartAC()
{
GameRunning_UI.SetActive(true);
var GameProcess = Process.Start(new ProcessStartInfo
{
FileName = Acs_exe_path,
WorkingDirectory = AcRootDirectory,
});
if (GameProcess == null || GameProcess.HasExited)
{
UnityEngine.Debug.LogError("Failed to start game process!");
return;
}
GameProcess.EnableRaisingEvents = true;
GameProcess.Exited += p_Exited;
// Log some debugging information
UnityEngine.Debug.Log($"Game process started with ID {GameProcess.Id}");
}
void p_Exited(object sender, EventArgs e)
{
GameExit();
}
void GameExit(){
UnityEngine.Debug.Log("Game process exited!");
GameRunning_UI.SetActive(false);
Out_Script.GetResults();
}
When I call StartAC() the GameRunning_UI gets activated the process starts, I get the log “Game process started with ID” in the console
and when I exit the process, GameExit() seems to get called, I get “Game process exited!” in the console. But anything else after do not continue. GameRunning_UI never gets disabled and neither does the GetResults() get called.
How I can solve this issue?