How to set the file target for a high res screenshot

I have used Flash7’s solution but don’t have a good c++/UE background so here’s my (possibly mistaken!) interpretation of what’s happening for anyone else who is struggling to understand how to use the provided solution:

  • The aim is to record high-resolution images from the Unreal Engine viewport. It’s possible to move the viewport view to a specified camera by calling the SetViewTarget method on a player controller, so by placing a camera in the game you can move to that camera and record the corresponding image.
  • As outlined in the original question,

I can save a regular screenshot to a location, and I can save a high-res screenshot to the default Screenshot directory, but I can’t seem to do both at once.

  • (If anyone can clarify this further please do) The solution is to add a lambda function (good outline of lambda functions here) to the OnScreenCaptured method of the GameViewportClient (the engine’s interface to a game viewport). The lambda function essentially takes the gameviewport image as a bitmap and then saves it to a specified file path when a screenshot request is made. When GetWorld()->GetGameViewport()->Viewport->TakeHighResScreenShot(); is called, the onscreenshotcaptured method (an Accessor for delegate called when a screenshot is captured) is called, which executes the code in the lambda function as outlined above.