how to determine if a breakpoint was triggered on the server or on the client? In VS debugger without modifying code?
AActor has its network role saved as member (Role). If your breakpoint is inside an actor class, you can check this variable directly in the debugger watch window. If the breakpoint is inside an actor component, you have to type something like PawnOwner->Role.
Since this is still the #1 result on Google related to debugging server vs client on Visual Studio, Iâll add that you can use the following expressions to check whether youâre on a server or which client the current code context is being executed. Just put them into the âevaluate expressionâ section of your IDEâs debugger and youâll get a string giving you those details:
UE4 on Visual Studio:
UE4Editor-Engine!GPlayInEditorContextString
UE4 on Rider:
{,,UE4Editor-Engine.dll}GPlayInEditorContextString
UE5 on Visual Studio:
UnrealEditor-Engine!GPlayInEditorContextString
UE5 on Rider
{,,UnrealEditor-Engine.dll}::GPlayInEditorContextString
Thank you for this, Iâve been looking for a solution to this simple problem for ages. That said, it seems that the syntax for Rider requires two commas after the opening brace, i.e.
{,,UE4Editor-Engine.dll}::GPlayInEditorContextString
{,,UnrealEditor-Engine.dll}::GPlayInEditorContextString
Ah, yes, youâre right! Typo on my part. Will edit my original answer.
EDIT: Lol, it was the HTML formatting eating one of the commas
Thank you! Very, very helpful!