Hello,
I’ve started working with UE4 and C++ two weeks ago, because we’ve switched engines for our newest project at work. So, I need to take a screenshot of a VR application to then display it somewhere else.
So far I’ve encountered two issues:
- Whenever I take a screenshot, the game freezes momentarily, so much so that I’m sent back to that Steam aurora hub for a moment. This might be because I’m taking two screenshots, one after another. I do this because I need to place the same screenshot in two different folders.
- I can’t figure out how to take a regular 16:9 screenshot while in VR. If I could just crop the feed from one eye to make it 16:9 that would be enough.
Here’s the code I’m using to take the screenshots:
void AScreenShotTaker::BeginPlay()
{
Super::BeginPlay();
tryToTakeAnotherScreenshot = false;
timeSinceLastScreenShot = 0.f;
GetWorldTimerManager().SetTimer(screenShotTimerHandle, this, &AScreenShotTaker::TakeScreenShot, ShotFrequency, true);
}
// Called every frame
void AScreenShotTaker::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (tryToTakeAnotherScreenshot && !FScreenshotRequest::IsScreenshotRequested())
{
TakeSecondScreenShot();
}
}
void AScreenShotTaker::TakeSecondScreenShot()
{
FString fileName2 = ("C:/Users/Me/Downloads/UE4_Prints/ToCast/ReplaceMe.png");
FScreenshotRequest::RequestScreenshot(fileName2, false, false);
UE_LOG(LogTemp, Warning, TEXT("File Name 1 : %s"), *fileName2);
tryToTakeAnotherScreenshot = false;
}
void AScreenShotTaker::TakeScreenShot()
{
FString fileName("C:/Users/Me/Downloads/UE4_Prints/Archive/KeepMe.png");
FScreenshotRequest::RequestScreenshot(fileName, false, true);
tryToTakeAnotherScreenshot = true;
UE_LOG(LogTemp, Warning, TEXT("File Name 0 : %s"), *fileName);
}
Thank you for your time.