JetBrains / resharper-unity

Unity support for both ReSharper and Rider
Apache License 2.0
1.21k stars 134 forks source link

Do something useful with UNITY_GIVE_CHANCE_TO_ATTACH_DEBUGGER env var #388

Open citizenmatt opened 6 years ago

citizenmatt commented 6 years ago

If you set the UNITY_GIVE_CHANCE_TO_ATTACH_DEBUGGER environment variable to 1, then a standalone player will show a message box giving the user chance to attach a debugger before Unity is initialised.

Investigate and figure out what we can do with this - e.g. add a run configuration for standalone players?

Suggestions welcome...

van800 commented 4 years ago

Produces 2 dialogs. First one "You can now attach native debugger", second one "You can now attach managed debugger".

juzerneem commented 3 years ago

It's handy for debugging editor scripts; you can attach VS to the Unity editor while not 'playing'.

van800 commented 3 years ago

@juzerneem The reason, why we are not using this env var, is that we can attach to UnityEditor even without it. You may try to close Unity and click on a "bug" icon in Rider toolbar. image It will start UnityEditor and attach debugger to it. Latest improvements to this feature were done just recently and would become public in Rider 2021 EAP1. In Rider 2020.3 it also works but not so stable.

juzerneem commented 3 years ago

I use Visual Studio and if you don't set the environment variable (and get those two annoying messages), you can't attach to Unity without pressing play. Perhaps I should look into Rider...