Download

Debugging in C++

Hi C++ programmers,

Since I been migrating to Java for my software developments, I think it will be wise to continue using C++ for game development so that I wouldn’t lose any skills in programming in C++. One thing I like about blueprints is that I can see the signal move from component to component which is very helpful for debugging. Any tools that I don’t know about that would make debugging easy in Visual studios? I can imagine that it can get pretty messy programming a game.

Thanks

You still have breakpoints which you can set by clicking on the left side of the code along the pane. When execution reaches there the program will pause and let you check state.

There are various ways to debug using Unreal specific method functions, which I believe Rama made a wiki post about. The one I use the most is GLog->Log(“MessageHere”) which outputs your message to the output window.

Debugging in visual studio is the most powerful debugging tool I’ve used. It’s the standard I measure all other debugging tools against :slight_smile:

It’s worth your time to get really good at debugging in VS. Learn how to set break points, how to set watches on your variables, how to go up and down the call stack, how to look at your object memory, etc.

When I get really deep into the weeds with debugging something, I often create a notepad++ document and start copy/pasting debug information I want to track.

One really handy tip for debugging unreal games: When you want to debug something, press the “pause” button on your keyboard. The game will freeze its frame. Then you can open up a blueprint and set a breakpoint. Then, open the game window up and press “pause” again to unpause the game. If that blueprint executes any code on the next frame, you’ll hit your breakpoint with your instance variables. If you have the engine code available, you can also view the engine code for each blueprint node and step through that, line by line, to see what’s happening behind the scenes.

Protip: Make sure that you compile your game with “DebugGame Editor” configuration.