Screenshot with customdepth as alpha, In Shipping build (C++)

Hi, I am trying to recreate an editor-only function (HRSS) for a shipping version of the project. The following code functions during PIE but not when packaged.

GetHighResScreenshotConfig().bMaskEnabled = true;
GEngine->GameViewport->Viewport->TakeHighResScreenShot();

This is probably because of the #if WITH_EDITOR condition in HighResScreenshot.cpp on line 46 which uses some editor only classes/material to create and merge the mask which is generated in the custom depth buffer.

So is there a way around this without modifying the engine? Or do I need to recreate most of the functionality to get it working in the client. I am hoping it possible to access the render buffer to get the customdepth pass and pass it into the highres screenshot class when it comes to merging the two textures together

Did you make any progress on this?

Sorry for the slow reply, I didnt make much progress with this. It seems like it required some engine modification to get the function working in runtime, or some workaround setup using render targets and texture composition

Only way to do it is either enigne modification or redoing, study the code in engine and try to reproduce. There might be real reasons why #if WITH_EDITOR is there, most likely use of editor API or knowing UE4 RHI code there might be linking issue due to compromises made to speed up linking process. If you study code you most likely find reason why is that the case