Debugging Lightmass Code in UE5 with Visual Studio 2022: Symbols Not Loading

16 Views Asked by At

I'm currently debugging Unreal Engine 5 (UE5) source code using Visual Studio 2022 and am interested in stepping through the Lightmass code related to precomputed visibility. However, I've encountered an issue where breakpoints set within the Lightmass code are not triggered, displaying the message "No symbols have been loaded for this document." When launching and debugging the Lightmass project independently, breakpoints work as expected.

Upon inspection, I noticed that the Lightmass-related DLLs and PDB files are not loaded during a debugging session of the UE5 project. It appears that Lightmass project, being a separate project, does not automatically start or load its symbols when debugging the UE5 project.

I attempted to start the light build process within the editor and then manually attach the debugger to the process, but this approach did not work. Further investigation revealed that the Lightmass executable launched by VS2022 is located in "Engine\Binaries\Win64", whereas the editor initiates Lightmass from the "Saved\Swarm" directory.

Is there a way to effectively debug Lightmass-related code in this setup?

1

There are 1 best solutions below

0
Samaursa On

This is because UnrealLightmass is an executable that is launched as a separate process from the Swarm Agent. To debug light mass, you will have to follow the same steps that you would to debug any other executable.

enter image description here

I will assume that you are using Visual Studio but the steps can be replicated in other IDEs (or debuggers) that support attaching to a process directly:

If you are launching the Editor from Visual Studio:

  • Use CTRL+F5 to launch the editor (this is so that your IDE is free to attach to another process) OR
  • If editor is already running, go to Debug -> Detach All in Visual Studio

enter image description here

Once your IDE is not attached to the Editor (but the Editor is still launched):

  • Go to Debug -> Attach to Process
  • Find UnrealLightmass.exe and click Attach

enter image description here

If all goes well, you should be able to attach to and debug LightMass at this point.