Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Feedback Restore "debugger mode" setting upon editor restart

Discussion in '2020.1 Beta' started by Peter77, Apr 17, 2020.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    Please implement to save and restore the "debug mode" option, so I don't have to turn it on every time I restart Unity.

    I'm talking about this option:
    upload_2020-4-17_17-8-39.png

    The current implementation is not useful, because:
    • Start Unity
    • Enter playmode
    • See something suspicious
    • Switch to Visual Studio, set breakpoint
    • Hit "Attach debugger" button
    • Nothing happens
    • Switch back to Unity to see whats wrong
    • Get greeted with this dialog:
    upload_2020-4-17_17-11-49.png
    • Press "Switch to debug mode"
    • Unity exits playmode
    • Unity recompiles
    • Unity finished and ready to debug
    ... aaaand what I wanted to debug is lost, because Unity exited playmode and recompiled.
     
    undevable, Wobbers, Awarisu and 2 others like this.
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    It's there in preferences:

    upload_2020-4-17_13-38-36.png
     
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    Nice, thanks for the tip!

    Here is some feedback for this dialog:

    • Add text that tells it's possible to switch to debug mode permanently via Preferences using "Code Optimization On Startup".
    • Add "Switch to debug mode permanently" button.
    • Mention that "switch to debug mode" also exits playmode.
    • Think about using the same terminology ("debug mode" vs "code optimization").
     
    NeatWolf, QFSW, Awarisu and 3 others like this.
  4. Art-Leaping

    Art-Leaping

    Joined:
    Apr 2, 2015
    Posts:
    22
    It doesn't exit play mode.
     
  5. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    Well, it did for me.
     
    hippocoder likes this.
  6. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It will depend on the setting for compilation during play mode as scripts will recompile once this setting is also enabled.
     
    Art-Leaping likes this.
  7. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Is this something new since 2019? I noticed since switching to 2019 that whenever I attach the debugger it tries to recompile something, sometimes even requiring to restart playback (not always).
    This didn't happen in unity 2018, now attaching the debugger is super slow at least with visual studio.
     
  8. Awarisu

    Awarisu

    Joined:
    May 6, 2019
    Posts:
    215
    I think this is a 2020 thing, I've never seen this dialog box in 2019 and I'm definitely attaching the debugger at pretty random points in time.
     
  9. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Thank you for the feedback. We got similar feedback from developers internally and before I was made aware of this thread, I already had a change pending to change this dialog. It hasn't landed yet.


    Multiple people internally have mentioned that "Switch to debug mode for all sessions" is confusing. Do you think "Switch to debug mode permanently" is more clear?

    I think it makes sense to add this.

    I think this only happens if you have "Script Changes While Playing" set to "Stop Playing And Recompile"
     
    bugfinders, NeatWolf and Peter77 like this.
  10. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    Is the API in place so we can create our own buttons for "switch to debug mode and enter play mode" or "switch to optimized mode and enter play mode"?
     
  11. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    Hi Lukas,

    thanks for your answer and asking for further feedback.

    Both sound fine to me, but let me throw in a few more ideas:

    Enable debug mode | Cancel | Enable debug mode temporarily


    Disable C# optimization | Cancel | Disable C# optimization temporarily


    I think I would choose whether to use "debug mode" or "C# optimization" depending on the terminology used in the editor preferences window, or change the label in preferences to match with this dialog.
     
  12. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Yes.

    https://docs.unity3d.com/2020.1/Doc...ion.CompilationPipeline-codeOptimization.html
    https://docs.unity3d.com/2020.1/Doc...pilationPipeline-codeOptimizationChanged.html

    Related APIs:
    https://docs.unity3d.com/2020.1/Doc...ilationPipeline.RequestScriptCompilation.html
    https://docs.unity3d.com/ScriptReference/EditorUtility.RequestScriptReload.html

    Commandline options have also been added to startup with a specific code optimzation:

    -debugCodeOptimization
    -releaseCodeOptimization

    https://docs.unity3d.com/2020.1/Documentation/Manual/CommandLineArguments.html

    Edit: Fixed and added links
     
    Last edited: May 14, 2020
    Baste likes this.
  13. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    I think "Set debug mode as default" or "Start in debug mode by default" is clearer than "Switch to debug mode permanently". The latter conveys that I can't switch back and that's not true.
    "Switch to debug mode for all sessions" is the most unclear in my opinion.
     
    bugfinders and QFSW like this.
  14. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Here is a new suggestion for the dialog/buttons, let us know what you think :)

     
    brunocoimbra, Baste, Awarisu and 2 others like this.
  15. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    That looks way better.
     
  16. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    Contains all the necessary information and functionality. It's fine.
     
    Awarisu likes this.
  17. Awarisu

    Awarisu

    Joined:
    May 6, 2019
    Posts:
    215
    It's blessed by QA Jesus, you literally can't go wrong with it
     
  18. Hyp-X

    Hyp-X

    Joined:
    Jun 24, 2015
    Posts:
    438
    It would also be nice if I could enable debug mode by clicking on this bug icon down there:

    upload_2020-5-26_18-18-27.png

    Right now clicking on it does nothing.
     
  19. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    If I click on the icon, a new window appears where I can enable debug mode. See at 6:40 here.
     
    Last edited: May 27, 2020
  20. Hyp-X

    Hyp-X

    Joined:
    Jun 24, 2015
    Posts:
    438
    (Case 1250792) Cannot enable debug mode when Unity is maximized on the second monitor

    1. What happened

    Clicking on the "bug icon" on the status bar doesn't display the window that is used to switch between debug and release editor mode.

    2. How we can reproduce it using the example you attached

    This is reproducible in an empty project

    > Test this on a computer with 2 monitors. (Both of my monitors have 100% scaling)
    > Make sure that the secondary monitor is to the LEFT of the primary monitor.
    > If the secondary monitor has taskbar enabled, make sure it is NOT docked to the right edge.

    > Maximize Unity on the secondary monitor
    > Click on the Debug icon.
    > The popup window doesn't appear

    3. More information

    The issue is reproducible without maximize as well.
    If the debug icon is close to the right edge of the secondary monitor the popup does not appear.
    The threshold distance is slightly larger than the with of the 4 icons combined.

    This issue also reproducible in 2020.2.0a11
     
    bugfinders, LeonhardP and Peter77 like this.