Screenshot with UI to memory buffer

Hello.

I know there’s much said about screenshots. But I have a specific task, and after 2 days of trying I ask for help.

I’m writing a small game, it’s actually 2D, made purely with UMG widgets. It’s supposed to run in HTML5, so I can’t save anything to the file system, that’s why I can’t make “FScreenshotRequest::RequestScreenshot” to work. My idea is to dump the data into a memory buffer, so I can send it in a POST request to the server, and then give user a link.

So I tried

UGameViewportClient* gameViewport = GEngine->GameViewport;
FViewport* InViewport = gameViewport->Viewport;
TArray<FColor> Bitmap;
FIntRect Rect(0, 0, InViewport->GetSizeXY().X, InViewport->GetSizeXY().Y);
bool bScreenshotSuccessful = GetViewportScreenShot(InViewport, Bitmap, Rect);

And indeed it does the job, but there’s no UI included.
I’m pretty new to UE, can you please point out, where should I search?

Offtopic: My other idea was to take a screenshot from the HTML canvas with JavaScript, but apparently it’s not easy at all too. I took me a day to realise that.

Thank you.

Any update on this? I’m searching for a similar solution: I want to take a screenshot of the current frame (with everything the player would see like UI) but directly write to Memory.

take a look at AFunctionalUIScreenshotTest

in Engine\Source\Developer\FunctionalTesting\Classes
RequestScreenshot() pretty much does what you need from the looks of it.