I'm trying to create some screenshots but ScreenCapture.CaptureScreenshot
actually captures the entire editor and not just the Game view.
public class ScreenShotTaker : MonoBehaviour
{
public KeyCode takeScreenshotKey = KeyCode.S;
public int screenshotCount = 0;
private void Update()
{
if (Input.GetKeyDown(takeScreenshotKey))
{
ScreenCapture.CaptureScreenshot("Screenshots/"
+ "_" + screenshotCount + "_"+ Screen.width + "X" + Screen.height + "" + ".png");
Debug.Log("Screenshot taken.");
}
}
}
What could be the issue? How to take a decent, game view only screenshot that includes the UI?
Note, the UI thing, I found other methods online to take a screenshot (using RenderTextures
) but those didn't include the UI. In my other, "real" project I do have UI as well, I just opened this tester project to see if the screenshot issue persists here too.