Download

LifeProTip: You can edit code while Visual Studio 2013 is debugging, and don't need to stop debugger

I am pretty sure seasoned UE4 developers know about this. Not just to brag about it, but rather I liked to give more awareness to this.

When developing in UE4 C++ and you are debugging your UE4 project, Visual Studio 2013 wouldn’t allow you to build your modified code while the debugger is running. That would be a minor annoyance if you were to stop the debugger, which closes the UE4, build your code, and debug again while waiting for UE4 to reload your project from the start. However, there is a way to debug your code and catch unhandled exceptions while at the same time, you are modifying code and hot reloading.

To do this, you run multiple instances of Visual Studio 2013 by opening your project solution file multiple times. Have one of the Visual Studio 2013 (A instance) debug the entire solution, and the other Visual Studio 2013 (B instance) open up your codes and be standing by. Once UE4 has loaded up, you can use B instance to add/modify/remove/build codes as you see fit, while A instance will be solely used for catching unhandled exceptions, crashes, logic errors that simply building the code in B instance wouldn’t detect, and so on. Also, if UE4 crashes in A instance, you can just tell A instance to restart debugging UE4 again with a simple mouse click (or a hotkey). It helps to reduce the recovery time you need to have after a crash has occurs, thus saving time.

I used this method to catch a few unexpected bugs, such as this and this. If caught, you can also help out with the Epic Team in finding where the bug occurs, and reproduce it more reliably by giving them where exactly the code breaks when a crash occurred with a simple screenshot.

Useful, isn’t it?