UnityDoorstop icon indicating copy to clipboard operation
UnityDoorstop copied to clipboard

Doorstop does not initialize when game process spawns itself/restarts itself

Open TerameTechYT opened this issue 7 months ago • 0 comments

I have worked on a BepInEx plugin that automatically updates itself, and user is given a restart prompt. When you call Process.Start on the running game, it will inherit the environment variables from the running process for the newly spawned process, causing Doorstop to not initalize properly in the new process.

(i know #34 exists)

I have found a workaround for anyone else that has this issue

var startInfo = new ProcessStartInfo();
startInfo.FileName = Paths.ExecutablePath;
startInfo.WorkingDirectory = Paths.GameRootPath;
startInfo.UseShellExecute = false;

// remove environment variables that new process will inherit
startInfo.Environment.Remove("DOORSTOP_INITIALIZED");
startInfo.Environment.Remove("DOORSTOP_DISABLE");

Process.Start(startInfo);

Application.Quit();

TerameTechYT avatar May 20 '25 11:05 TerameTechYT