Screenshot Function In Packaged Game

Hi! I have a camera feature in my game that uses the “HighresShot 1” Command when it saves a pic. I have it set up to save the image to my desktop that I specified in the project settings window.

My question is, when I package my game, how would it be possible to have a relative filepath so that the picture would save on another user’s PC?

1 Like

Still looking for an answer. Anyone?

There is nothing built into the engine that I am aware of that would send this picture across a network to another users PC.
Something you would have to code in yourself, unless you leverage Steam or some other system that allows screenshot sharing.

i think op means save to a non hard coded filepath like */user/pictures/screenshots and not something like c:/users/XXmikeXX/pictures

Yes, this is what I meant thank you

I’m still trying to figure this one out, any suggestions?

quick question, where did you set the filepath? was it in a config file? just so i can have a play around and see if i can get something working

Sure! The screenshot directory is in the Project Settings under Engine - General Settings

Anyone ever figure this out? I’ve struggled mightily on this.

I’m trying to figure this out but nothing yet

Write a platform specific plugin that does the right thing for each platform.
On Windows, call SHGetKnownFolderPath() and return that path.
On MacOS, call NSSearchPathForDirectoriesInDomains().
On Linux, use getenv(“XDG_PICTURES_DIR”) and if that’s empty, use getenv(“HOME”)+"/Pictures"
On Android, iOS, and other systems, use the respective appropriate system-specific methods.

Assuming you know a little C++, and have Visual Studio/C++ 2019 installed (not VS Code!) (community Edition is fine) then it’s actually quite easy to write a Blueprint Library in C++ to export functionality from a few functions.

hardcoding your desktop path is the trap, it only ever works on your machine. two fixes that compose well.

first, never hardcode: resolve per user (ProjectSavedDir style paths) or just ask the player where to save. a Save File dialog with a default file name is the friendly version, no typing paths like its ms-dos.

second, the picker has to survive packaging. Async Runtime File Dialog, a native file picker plugin for Unreal Engine 5, is a Save File Picker node with On Saved returning the path and On Cancelled if they back out, built for packaged Win64 games on 5.0-5.8: Async Runtime File Dialog — Native OS File Picker for Blueprints | Fab

then pass that path to your HighResShot filename. one pick, works on every player pc.