NeighTools / UnityDoorstop

Doorstop -- run C# before Unity does!
GNU Lesser General Public License v2.1
419 stars 62 forks source link

Doorstop still doesnt work on first launch #34

Open CptMoore opened 1 year ago

CptMoore commented 1 year ago

version: v4.0.0 release platform: Windows game: BattleTech distribution: Steam

Issue; Doorstop uses ENV variables to keep track if it already ran, but dynamically set ENV variables are copied by steam during a restart of the games process.

Steps to reproduce:

Workarounds not working:

Fix ideas?

Reference for RogueTech Discord: #rogueticket-7596

Logs when using the ignore_disable_switch workaround: log before restart log after restart

ghorsington commented 1 year ago

Greetings!

Clear all dynamically set doorstop env variables if doorstop detects that it is in a new unmodified process, leading to doorstop to run again.

Unfortunately that's what the DOORSTOP_DISABLE and DOORSTOP_INITIALIZED are already meant for. To my knowledge, it's the only platform-agnostic way to save process state so that

The former point was originally made when BepInEx (the first tool that used Doorstop) didn't have mitigations against the game running multiple versions of itself in different modes (e.g. client + dedicated server). Nowadays, BepInEx is able to handle those situations fairly well, so I think that a better solution is to

These combined, Doorstop would allow multi-instance runs. It will then be the responsibility of Doorstop users to make sure their code can handle the same game being run in multiple instances at the same time (should be a nonissue, really).

CptMoore commented 1 year ago

That would work for us as we dont have servers or expect multiple concurrent instances to be valid. The name of the new variable is ok, i use enforce_single_instance for a similar use case, but that quits the process hard. The defaults also make sense due to end user friendliness for steam users.