I had the same need in a project. Currently, I did not find a blueprint node to this.
So I wrote a simple blueprint callable method in a C++ class.
I use RequestScreenshot from FScreenshotRequest | Unreal Engine Documentation to take the screenshot.
To define the save path, you need to know that the Camera Roll on iOS is at /private/var/mobile/Media/DCIM/
So, using this path plus the file name you want to the image will do what you want.
Your method can be as simple as this:
In my case, I created a Blueprint class based on this C++ class (which is based on the Actor class) and I put it in my map as an Actor, being able call TakeScreenshot from it.
In the end we used a different solution. For some reason we did not have the time to understand, this solution did not work for the most recent versions of Unreal Engine and iOS.
What we ended doing is:
We created a C++ class with a blueprint callable method that calls FScreenshotRequest::RequestScreenshot. This time we did not use a custom path, just a filename, “Image.png”, and we let Unreal save the screenshot on its default folder. As return from this method, we get the path, calling FScreenshotRequest::GetFilename, so we know where the screenshot is saved (“/YourProjectName/Saved/Screenshots/IOS/Image.png”).
In this same class we created another blueprint callable method only to check if the screenshot is ready (it takes miliseconds, but it’s not instantly done). This can be done with FPaths::FileExists, using the path from the previous method.
Then we created another blueprint callable method to call an Objective-C method. Well, that’s the tricky part, but that’s what worked for us. When we learned that is possible to mix Objective-C code inside the .cpp file, we decided to use a iOS native method to save the screenshot to the album. The method is UIImageWriteToSavedPhotosAlbum. It needs a UIImage as parameter and for that we created an UIImage with imageWithContentsOfFile, passing that path from step 1.
For this third step, you need to know how to call a native iOS method from a .cpp file. What helped us was this two links:
Finally, back to Unreal Editor, we created an Actor with this class, put it in our map, created a reference to it on the level blueprint, and call the C++ methods from it.
Because we are always using the same filename to the screenshot, we need to delete it after saving it to iOS album, so it’s not mistaken by FPaths::FileExists. For this we used FPlatformFileManager::Get().GetPlatformFile().DeleteFile.
In the end, it looked like this: Screenshooter.cpp
Hi andreischwingel ,
Did you have the full finishing of the function, i would to buy with you.
Because i need it urgent. please relpy me as fast you can,
i precious it,thank you
Hi! I was traveling and could not answer.
I don’t have the full project anymore. But I will reproduce the steps I wrote above and send you the project someway.
Hi. By chance, anyone knows if Epic implemented a solution so we dont have to use C/C++ (due I am actually working with a PC Computer to the Ipad, so its seems I need a mac to develop code to test to the ipad and unfortunatelly I dont have one)
Has anyone managed to figure this out yet? I’d really like to find out how to take a screen shot in app and have it saved to the camera roll too. I can’t code yet either