Background/Situation [Optional]
Unreal Engine allows launching the game standalone (not in the dedicated viewport inside of Unreal Editor).
In such a scenario, it runs in a dedicated process. Launching UE editor via "Debug", then launching Standalone Game, the debugger will not attach to this process by itself. It only will be attached to the UnrealEditor process launched from Rider. One might want to attach the debugger to such a Standalone Game instance. Attempting to run the standalone game and then "Attach to Process" has two disadvantages:
- The debugger doesn't attach right from the process start (because it takes time for a person to attach debugger, it requires several clicks and searching the proper process in the list/typing the process name to find the process quicker);
- Since the debugger isn't attached from the start, catching the errors that might occur in the early stages of the game initialization is complicated;
Question
How to attach the debugger to a Standalone game right from the process start?
Answer
-
(Windows only). To use the “Child Process Debugging” feature (File | Settings | Build, Execution, Deployment | Debugger). If it is enabled, and the project is launched under “Debug”, Rider can attach the debugger to child processes spawned by the target executable. So, it can attach to the Standalone game process spawned by Unreal Editor. It allows avoiding manual “Attach to process” steps. Upon ticking this option, be sure to configure the settings file. There is an instruction inside. The below sample config worked out for me:
<DefaultRule attach="false"/><Rule processName="part_of_path*/my_app*" commandLine="-arg1" attach="false"/><Rule processName="UnrealEditor" attach="true"/> -
Another accurate option for debugging the Standalone Game is to make a dedicated Run Configuration for that:
-
Go Run | Edit Configurations;
-
Add ('+') a “Native Executable” run configuration;
-
Set “Exe path:” to
C:/YourPathToEngineRoot/Engine/Binaries/Win64/UnrealEditor.exe; -
Set “Program arguments:” to
"C:\PathToYour\DebugTest.uproject" /Game/DebugMap -game -PIEVIACONSOLE -Multiprocess GameUserSettingsINI="PIEGameUserSettings0" -MultiprocessSaveConfig -forcepassthrough -messaging -SessionName="Play in Standalone Game" -windowed -ResX=1280 -ResY=720`; -
Set “Working directory: ” to
C:/YourPathToEngineRoot; -
Remove the “Build solution” Before launch step and add “Build project ‘GameProject’” instead;
-
Apply the changes.
-
Now the standalon game can be launched from Rider in a single click; (selecting the configuration from the toolbar in top-right corner → click “Debug” or "Run")
-
Comments
0 comments
Please sign in to leave a comment.