Search Unity

Disable Visual Studio's mirroring of Debug.Log output

Discussion in 'Code Editors & IDEs' started by MV10, Feb 27, 2016.

  1. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
    How do I disable Visual Studio's Error List output of Debug.Log messages?

    I'm using VS 2013 Pro with the VS Tools add-on. I am fine-tuning a bunch of PIDs and that involves a ton of Debug.Log output, and of course, Tools mirrors the Unity console output in the VS Error List window. For some reason Microsoft has never provided a way to reset the Error List without compiling (or completely restarting Visual Studio). Since I'm tweaking PIDs in the inspector, there is little or no compilation going on. After while the Error List becomes quite large. If I forget to compile to wipe it, or if I let the sim run for awhile, there will be thousands of entries. At that point, when I stop or pause the program, VS will hang for a very long time (I think it's catching up, the output on the VS side lags badly compared to the Unity console).

    The instructions only say "If you don't want to see errors, warnings, and messages from Unity in Visual Studio's Error List window, you can disable them in the Configuration menu."

    Lovely. Where is this configuration menu? It isn't in VS Options -> Tools for Unity, which is the logical place to look. Or is it somewhere in Unity?
     
  2. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
    I have found that Build / Clean Solution quickly resets the Error List (when I remember to do it). Of course, if I'm watching a particularly long-running test the log fills up anyway and it's still slow, so this is only a minor convenience.

    In Unity I can go into Edit / Preferences / General Tools and uncheck Editor Attaching, but that also prevents debugging.

    Edit: The setting in Unity doesn't work. It says a restart is required. Logging/attaching is indeed off the first time I run the project, but that checkbox doesn't stay cleared and VS is attached on all subsequent runs. (Running from the Unity play button only, not starting from within VS and certainly not using the Attach to Unity button in VS.)
     
    Last edited: Feb 28, 2016
  3. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Hi! Know you posted this some time ago, but i found a solution to your problem. The setting sadly isnt exposed in a UI anymore but it is in code, so make sure that you call this when you start the editor:

    Code (csharp):
    1. SyntaxTree.VisualStudio.Unity.Bridge.Configuration.Configurations.Active.SendConsoleToVisualStudio = false;      
    2. SyntaxTree.VisualStudio.Unity.Bridge.Configuration.Configurations.Active.Write();
     
    Last edited: May 25, 2016
    MV10 likes this.
  4. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    Why not just click the Errors icon at the top of the Error List window? It will hide all of the errors.
     
  5. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
    It still lags, hiding them doesn't break the connection with Unity.
     
  6. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    I guess the first question is... what are the errors you're seeing? I didn't realize Debug.Log actually put things in the Error List unless there's actually an exception somewhere.
     
  7. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
    All Unity console output goes to the VS Error List window.
     
  8. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    Oh I see... they're not errors. They're "Messages". Not sure why Unity uses the Error list rather than the Console.. Anyway, see the dropdown next to Messages? Change it from Build + Intellisense to Build Only. That will remove all of those messages. It doesn't just hide them, it also removes them from the output window there.
     
  9. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
    The VSTU folks posted a work-around here but I've been meaning to ask (out of curiosity) where this Messages dropdown is located. Maybe you're using VS2015? I'm still on 2013...

    1.jpg