Does anyone know how to see log messages (either in Visual Studio or in the Godot editor) when running a Godot game from Visual Studio?

I tried: GD.Print(), Trace.Write(), Debug.Write() - none shows up in the VS Output window or in the Godot editor if the game was started from Visual Studio.

Thanks

  • You can use something like:

    Debugger.Log(2, "inf", "Debug msg here...");

    Bit verbose to write compared to GD.Print(), but it works if you need output..

    Hope it helps..

4 days later

I am having the same Problem, my workaround for now is to start the application via the Godot editor and then have VS attach to the Process, it's not perfect but that way you have your Output in the Godot editor and you can still use Breakpoints in VS.

    alovaros When you try to "launch your game" from VS, what really happens is it launches the Godot editor lobby (project selector), and then when you choose the project, it spawns a new Godot process with your game. But the VS debugger is attached to the lobby process, not your game process.

    Try specifying the path to your game's project file on the cmd line (in VS debug properties).

    godot.exe --path <path_to_folder_with_project>

    (Caveat: I haven't tried the above)

      Haystack
      Sadly didn't work out.
      If I do what you said with the godot_console.exe I do get my outputs (without it it just behaves like before) but if I do that VS can't load the debug symbols properly so I can't debug anymore.

        alovaros
        That's a real bummer. This seems like such an obvious thing everyone using an external editor would need.
        Any way to programmatically tap into Godots output so we can at least display our own and other messages in-game them?

        You can use something like:

        Debugger.Log(2, "inf", "Debug msg here...");

        Bit verbose to write compared to GD.Print(), but it works if you need output..

        Hope it helps..

        3 months later

        create a wrapper around the output method, then in the wrapper set a Tracepoint