No log messages when running game from Visual Studio
Asked Answered
A

6

0

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

Astomatous answered 20/9, 2023 at 10:38 Comment(0)
S
0

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..

Synovitis answered 26/9, 2023 at 8:4 Comment(0)
S
0

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.

Sheepshank answered 24/9, 2023 at 11:27 Comment(0)
I
0

Sheepshank 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)

Insentient answered 24/9, 2023 at 15:46 Comment(0)
S
0

Insentient
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.

Sheepshank answered 25/9, 2023 at 7:26 Comment(0)
A
0

Sheepshank
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?

Astomatous answered 25/9, 2023 at 8:56 Comment(0)
S
0

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..

Synovitis answered 26/9, 2023 at 8:4 Comment(0)
K
0

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

Kronstadt answered 7/1 at 2:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.