Screenshot command not works on android

hello evehal

I made this for desktop, but should work:




bool UMyBlueprintFunctionLibrary::doScreenShot(FString filePath)
{
	if (GEngine)
	{
		FHighResScreenshotConfig &HighResScreenshotConfig = GetHighResScreenshotConfig();
		UGameViewportClient* GameViewport = GEngine->GameViewport;
		if (GameViewport)
		{
			HighResScreenshotConfig.SetHDRCapture(false);
			FViewport *Viewport = GameViewport->Viewport;
			if (Viewport)
			{
				Viewport->Invalidate();
				TArray<FColor>data;
				if (Viewport->ReadPixels(data))
				{
					for (auto& Pixel : data) { Pixel.A = 255; }
					HighResScreenshotConfig.SaveImage(filePath, data, Viewport->GetSizeXY());
					return true;
				}
			}
		}
	}
	return false;
}



1 Like