Using GPlayInEditorContextString To Find Multiplayer Context While Debugging In Unreal

Often when debugging a multiplayer game you’ll find yourself needing to understand which of your clients or servers breakpoint has been hit. Getting this value via PlayerState->GetPlayerID() and World->GetNetMode() can also be tedious, especially if you’ve not had time to set this up before hitting the breakpoint. Fortunately for us there’s a secretive variable that we can watch and it will do just that: GPlayInEditorContextString.

By just adding this variable as a permanent watch, you now get access to some fundamentally necessary information. The string will display the PIE window name which would be Dedicated Server, Client #, Standalone or Not In A Play World depending on your current situation.

Unfortunately this is an editor only feature but outside of the editor you should have a better understanding of which context you’re running from anyway as your clients should each be running with a unique process.

The syntax for Visual studio is:

UnrealEditor-Engine!GPlayInEditorContextString

Or if you use Rider you’ll need to use this format:

{,,UnrealEditor-Engine.dll}::GPlayInEditorContextString

There are also a few other useful variables mentioned in this tips and tricks guide.

Note: These only work for UE5 in this form. If you’re still using UE4 you’ll need to replace UnrealEditor-Engine with UE4Editor-Engine.


Discover more from Kieran Newland

Subscribe to get the latest posts sent to your email.

1 Comment

  1. Jacob says:

    Awesome stuff Kieran, Really apriciate these posts. i had been hoping for a solution to this problem for a while

Leave a Reply

Your email address will not be published. Required fields are marked *