Taking and saving screenshots to the user's drive

Was wondering if anybody knew how to save a high res screenshot on to the user’s drive in a packaged game. It saves the screenshot to the specified path and name from the open/save function while in the editor, but not in a packaged build.

(For reference, I’m using this plugin to get the save/open dialogue node: File System Library in Code Plugins - UE Marketplace)

Do you know if the Filename of the Take High Res Screenshot node is the entire path or just the filename? I would suggest looking closer at the C++ code if you are positive on using the Take High Res Screenshot. It’s most likely an easy task to change the directory even if you have no code experience. You could most likely modify it so that the Filename takes in the path and filename.

There seems to be a few other screenshot tools on the marketplace as well, like this one: ScreenShot Custom in Code Plugins - UE Marketplace

The Save to Path string does in fact take the entire path and the filename (so for example C:\Folder\Rendering.png). I’ve tried as an alternative to use the execute command function to take a high res screenshot (which to my knowledge only works with a development build). I specifically have to use the high res shot for my use case because I need to render with the custom depth to get transparency. Unfortunately running the command gives me a crash and the following error:

Assertion failed: Inputs.Material || Inputs.MaskMaterial || Inputs.CaptureRegionMaterial [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMaterial.cpp] [Line: 723]

Hmm, this error message is indicates that an assertion has failed in the PPM file. An assertion is basically a statement that verifies that the conditions specified are true; if they are not, the program will halt and report an error.

It seems that the code is expecting the inputs “Material”, “MaskMaterial”, or “CaptureRegionMaterial” to be present, but one or more of them is missing. This is likely the cause of the crash. You may need to debug the code or provide the missing inputs in order to resolve the issue.

Oh I see! I must have an issue in my command then.
According to the docs it’s

HighResShot filename=PATH (XxY OR Multiplier) CaptureX CaptureY CaptureW CaptureH bMaskUsingCustomDepth bDumpBufferVisualizationTargets bCaptureHDR bDateTimeAsFilename

So what I put in is: HighResShot filename="C:/RobodoCaptures/screenshot.png (3840x2160) bMaskUsingCustomDepth=1"

I tested filling out all properties and still got a crash too:
HighResShot filename="C:/RobodoCaptures/screenshot.png (3840x2160) CaptureX=1 CaptureY=1 CaptureW=1 CaptureH=1 bMaskUsingCustomDepth=1 bDumpBufferVisualizationTargets=0 bCaptureHDR=0 bDateTimeAsFilename=0"

Try to take a screenshot using the tool and not through blueprint. Do you get the same error?

The tool works (I assume you mean viewport->take high res shot).
When I put it into the console command bar it gave me an error that apprently I shouldn’t put the resolution into brackets and in a different place (is the documentation wrong?)

HighResShot 3840x2160 filename="C:/RobodoCaptures/screenshot.png (3840x2160) CaptureX=1 CaptureY=1 CaptureW=1 CaptureH=1 bMaskUsingCustomDepth=1 bDumpBufferVisualizationTargets=0 bCaptureHDR=0 bDateTimeAsFilename=0"
seems work in-editor but it doesn’t use the custom depth mask. I imagine I’m still doing mistakes here. I haven’t tried it yet with the development build but I guess if it’s without transparency in the editor I can safely assume it’ll be the same when packaged.

1 Like

I recommend trying to simplify the string by removing certain elements. For example, do all of the details in the string have to be included? It could be useful to find out if there are any default values that can be utilized in their default state, without being stated in the string.

1 Like

Thank you, I think you are leading me into the right direction. I’ve simplified the string to not use the property names, but I still had to to set either 0 or 1 for the properties, because bMaskUsingCustomDepth is one the later bools. So the following command works in the editor: HighResShot 3840x2160 0 0 0 0 1 0 0 0 filename="C:/RobodoCaptures/screenshot.png

But unfortunately in the development build the editor crashes with this command and returns the same error as previously…

I have also encountered this problem. Have you resolved it? In quick start mode and packaging mode, as long as the symbol represented by bMaskUsingCustomizaDepth is “1”, the engine will report an error Assertion failed: Inputs. Material | | Inputs. MaskMaterial | | Inputs. CaptureRegionMaterial.

Hi, unfortunately I had to abandon the project and I couldn’t solve it. I imagine with a custom license, the Epic Games staff in the UDN (Unreal Developer Network) forums are the only ones who could help with this issue.

Thank you for your reply. I also have to give up this implementation method. This issue is really strange, and I hope the management can see our discussion

Hiii, sorry for being late but I have the solution for it, maybe you don’t need it anymore but I’ll leave it here anyway maybe someone will run into the same problem:

so yeah the order is completely wrong in the documentation the correct syntax is this:

This is my example and it works just as well in a packaged build as in the editor

So for the F part all 4 of the options work that are there but I used the Project saved directory because it works in editor and in packaged without changing anything.

The G part is an optional directory that you can specify inside the previously chosen base directory

The H part is the name of the file and the “I” is the format

As far as I know the execute console command should work in shipping builds, it’s the print string that is development only and there it’s written on the node, so when something is development only it’s shown on the node

1 Like