Are you tired of relying on the same old PrintString for bug hunting? Boring! It’s time to level up your Unreal Engine debugging skills!
Join Unreal Engine Evangelist Ari Arnbjörnsson for a wild ride through advanced techniques and tools that will make bugs quake in their boots!
https://dev.epicgames.com/community/learning/tutorials/dXl5/advanced-debugging-in-unreal-engine
Outstanding, thanks!
Hi Ari!
Thank you so much for making this! This is an amazing collection of debugging tips!
Thomas Kadlec
Ari, this is some fantastic work. Thanks for helping developers everywhere!
Thank you Ari! This is incredibly helpful.
Quick tip for Rider users: If anyone else is having trouble with watching globals, here is what works for me:
@ ALREADY PREPROCESSED @{,,<ModuleName>.dll}<VariableName>
For GPlayInEditorContextString it looks like this:
@ ALREADY PREPROCESSED @{,,UnrealEditor-Engine.dll}GPlayInEditorContextString
Simply add the string above as watch. The <ModuleName>!<GlobalVarName>
notation does not seem to work in Rider.
Many Thanks!
My grain of sand for blueprinters
Cheatmanager blueprints have built-in useful funcions to call
and call your funciones in command line with ke *, or widget buttons
I learned a lot of debugging techniques that I did not know. Thank you very much.
There are two things that were not in the post that I would recommend as Debugging Tips.
The first is Rewind Debugger and the second is Gameplay Debugger.
Rewind Debugger
Gameplay Debugger
For Gameplay Debugger, perhaps there is a better link, as this document is probably out of date.
I would also suggest looking into sampling profilers. You don’t need any tracing macros, it just works. Where Unreal Insights has mysterious empty blocks, Superluminal will show you precisely what is happening down to the OS level function calls. As a bonus, Unreal can also redirect instrumentation into superluminal if you pass -superluminal on startup. You will be then able to see both sampled and instrumented data.
Although it is primarily focused on profiling, it can help also with debugging. You can very quickly understand what is going on, how the initialization is ordered, what is happening during your loading times.
Also, you can run console commands on the server if you use console command ServerExec “console command”.
I love Superluminal, I did NOT know that you could enable UE support for it with the -superluminal
startup parameter, that’s amazing!
How to learn GamePlay Debugger? have any learning resources?
Perhaps all web articles describing GamePlayDebugger are out of date and did not work well, as far as I could find.
I instead used the following .h and .cpp source code of the engine as a reference for implementation.
https://github.com/EpicGames/UnrealEngine/tree/072300df18a94f18077ca20a14224b5d99fee872/Engine/Source/Runtime/AIModule/Public/GameplayDebugger
https://github.com/EpicGames/UnrealEngine/tree/072300df18a94f18077ca20a14224b5d99fee872/Engine/Source/Runtime/AIModule/Private/GameplayDebugger
Other than the above, the comments section of this URL may be helpful.
https://github.com/EpicGames/UnrealEngine/blob/072300df18a94f18077ca20a14224b5d99fee872/Engine/Source/Runtime/GameplayDebugger/Public/GameplayDebugger.h#L11
Thanks, this is very useful!
It seems that your FString conditional breakpoint expression actually has a typo (an extra closed parenthesis at the end).
Current:
wcsstr((wchar_t*)MyFString.Data.AllocatorInstance.Data, L"Search substring"))
Fixed:
wcsstr((wchar_t*)MyFString.Data.AllocatorInstance.Data, L"Search substring")
Ah, thanks for spotting that!
Can anyone tell if it’s possible to use
{,UnrealEditor-Core.dll}::PrintScriptCallstack()
in Jetbrains Rider? I haven’t been able to find the Immediate Window when using Rider for C++ (only in C#).
If it helps anyone, the alternative I found was to call the function from LLDB:
call (void) PrintScriptCallstack()
Holy cow, what a treasure trove of information. Thanks!
these two helped me, since the docs seems to be outdated.
Great resource! Here are a few others:
GETALL : logs the property value for all instances of a class. Add “showdefaults” at the end to include class defaults as well
DISPLAYALL : display a property value for all instances of a class onscreen.
SET : set the property value for all instances of a class
(Take a look at the ManualAutoCompleteList under [/Script/EngineSettings.ConsoleSettings] in BaseEngine.ini for a pretty extensive list of handy console commands.)
Visual Studio:
- VS 2022 includes a new conditional breakpoint criteria: so that breakpoint A isn’t triggered until breakpoint B has been hit.
- Not sure when it was introduced, but you can now add breakpoints to groups, so that you can easily toggle all breakpoints in the group. Helpful for those cases when you’re fighting fires in several major systems at the same time, and don’t want to keep triggering breakpoints in code you’re not debugging at the moment, but also don’t want to toggle 14 breakpoints every time you switch between tasks.