Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a screenshot of the final game view, call ScreenCapture.CaptureScreenshot. To get pixels in code, wait until the frame finishes and use ScreenCapture.CaptureScreenshotAsTexture. To capture just one camera, render it to a RenderTexture and read that target. For repeated captures where synchronous readback is costly, consider Unity’s asynchronous GPU readback path.

Choose the capture method that matches your output

Unity provides several screenshot paths, and the main decision is whether you need the composed screen or an individual camera, and whether the result should be a file, a Texture2D, or a RenderTexture.

Need Use Important consideration
Save the final rendered screen as an image ScreenCapture.CaptureScreenshot Writes a PNG file; relative paths vary by platform.
Use the final screen pixels in code ScreenCapture.CaptureScreenshotAsTexture Call after frame rendering ends, commonly after WaitForEndOfFrame.
Capture one camera at a chosen size Camera → RenderTexture → Texture2D.ReadPixels Manage and restore active render targets and camera state.
Capture repeatedly while limiting main-thread readback work CaptureScreenshotIntoRenderTexture with AsyncGPUReadback Support and performance depend on the target project and platform; profile it.

Save the final game view as a PNG

ScreenCapture.CaptureScreenshot captures the current rendered screen output and saves it as an image file. This is the shortest route for a typical in-game screenshot that should include the final composed view rather than one selected camera.

using UnityEngine;

public class ScreenshotToFile : MonoBehaviour
{
    public void SaveScreenshot()
    {
        ScreenCapture.CaptureScreenshot("screenshot.png");
    }
}

Attach the component to an active GameObject, then call SaveScreenshot from a UI button, input handler, or other gameplay event. Unity saves a PNG and overwrites an existing file with the same name. Relative paths resolve differently on different platforms, so do not assume that a relative filename lands in the same folder in the Editor, a desktop build, and a mobile app.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a predictable writable path in a runtime app

For a built app, construct a full path under Application.persistentDataPath when you need a predictable writable location. Unity’s documentation notes that the exact resolution of relative paths is platform-dependent; the persistent data path is the appropriate starting point for app-owned saved data. Confirm the resulting location for the target platform and provide a way for users or your app to find the saved file.

Get the screenshot as a Texture2D

Use ScreenCapture.CaptureScreenshotAsTexture when your code needs the final screen image as a Unity texture—for example, to display a preview or encode it into another destination. The call must happen once frame rendering has ended; calling it during rendering can produce unpredictable results.

using System.Collections;
using UnityEngine;

public class ScreenshotTexture : MonoBehaviour
{
    public void BeginCapture()
    {
        StartCoroutine(CaptureAfterRendering());
    }

    private IEnumerator CaptureAfterRendering()
    {
        yield return new WaitForEndOfFrame();
        Texture2D image = ScreenCapture.CaptureScreenshotAsTexture();

        // Encode, display, or otherwise use image here.
        // Destroy(image) when it is no longer needed.
    }
}

The end-of-frame yield is part of the correctness of this pattern, not just a delay for convenience. Keep track of the returned texture’s lifetime: destroy it when your application no longer needs it, especially if captures happen more than once.

Capture only one camera

ScreenCapture methods capture the final screen output. For a single camera’s view, render that camera into a separate RenderTexture, then copy the pixels into a readable Texture2D with ReadPixels. This also lets you choose the output width and height independently of the current screen.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
using UnityEngine;

public static class CameraScreenshot
{
    public static Texture2D Capture(Camera camera, int width, int height)
    {
        RenderTexture target = new RenderTexture(width, height, 24);
        RenderTexture previous = RenderTexture.active;
        RenderTexture previousCameraTarget = camera.targetTexture;

        try
        {
            camera.targetTexture = target;
            camera.Render();

            RenderTexture.active = target;
            Texture2D image = new Texture2D(width, height, TextureFormat.RGB24, false);
            image.ReadPixels(new Rect(0, 0, width, height), 0, 0, false);
            image.Apply();
            return image;
        }
        finally
        {
            camera.targetTexture = previousCameraTarget;
            RenderTexture.active = previous;
            Object.Destroy(target);
        }
    }
}

Destroy the returned Texture2D when finished with it. The finally block restores the camera’s prior target and the previously active render target even if the capture path encounters an exception. In production code, also handle invalid camera references, dimensions, and allocation failures according to your app’s requirements.

What the camera-capture steps do

  1. Create a RenderTexture with the desired dimensions and depth buffer.
  2. Save the camera’s current target and the current RenderTexture.active value before changing either.
  3. Assign the new target to the camera and render the camera.
  4. Make that target active, then call ReadPixels to copy its pixels into the new texture.
  5. Call Apply when the texture data needs to be uploaded and used as a normal Unity texture.
  6. Restore the previous render target and camera target, release the temporary render target, and later destroy the returned texture.

ReadPixels reads from whichever render target is active. If the wrong target is active, the result can be blank or unrelated to the camera you intended to capture. The example uses TextureFormat.RGB24, so it does not request an alpha channel; choose a suitable texture format if transparency is required and supported by your rendering setup.

Increase screenshot resolution

The superSize overload increases the output dimensions by a scale factor for both the file and texture capture APIs. For example, 4 produces an image four times wider and four times taller—16 times the pixel count of the unscaled result.

ScreenCapture.CaptureScreenshot("print-shot.png", 4);

Higher resolution costs more memory and image-encoding work. Select a scale that matches the intended use, and check memory use on the actual target device rather than treating a large factor as free quality. This setting scales the screenshot output; it is not a guarantee that the scene will contain more detail than the camera, assets, and rendering configuration can provide.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Reduce main-thread readback work for repeated captures

A synchronous pixel readback can be a poor fit for tools or gameplay that capture frequently. Unity’s ScreenCapture.CaptureScreenshotIntoRenderTexture fills a supplied RenderTexture; that variant can be paired with AsyncGPUReadback to read pixels asynchronously and spend less time on the main thread. Consult the API documentation for the exact signatures and platform support in the Unity version used by your project.

This is a performance direction to evaluate, not a universal speed guarantee. Unity does not publish a benchmark that predicts the gain for every project. Profile capture frequency, resolution, target hardware, graphics API, and the rest of the rendering workload. Asynchronous readback also means the pixels become available later, so design callers to handle completion rather than expecting a finished image immediately.

Timing and render-pipeline considerations

For a full-screen Texture2D, yield to WaitForEndOfFrame before capture so the frame has finished rendering. For a camera render target, ensure that the intended camera has completed rendering before reading it, and set RenderTexture.active to that target before calling ReadPixels.

Projects using URP or another Scriptable Render Pipeline should use a timing point supported by that pipeline for the camera and render target being captured. Do not assume a legacy camera callback is always the correct moment: pipeline rendering order and camera configuration affect when the desired image exists. Validate the chosen hook in the actual project and pipeline.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common capture problems

  • The screenshot is blank or shows the wrong content: For ReadPixels, make the intended RenderTexture active first and ensure it contains completed camera output. For a screen texture capture, move the call to after frame rendering has ended.
  • The image is inconsistent between runs: Do not call CaptureScreenshotAsTexture while rendering is still in progress. Use an end-of-frame coroutine for the final screen, or an appropriate pipeline-supported timing point for a camera capture.
  • The file is not where expected: A relative filename is resolved differently across platforms. Use a full path under Application.persistentDataPath for predictable app storage, and inspect that platform’s actual path.
  • An existing image disappears: Unity overwrites a file with the same name. Generate unique names or check for an existing file before saving if preserving prior captures matters.
  • Captures cause memory spikes: Reduce the output dimensions or superSize, avoid retaining unused Texture2D objects, and destroy temporary textures and render targets when finished.
  • The wrong camera or camera settings appear: Verify that the intended camera is the one rendered to the target, and restore its previous targetTexture after capture so later rendering is not redirected accidentally.
  • Capture slows the frame: For repeated capture, test CaptureScreenshotIntoRenderTexture with AsyncGPUReadback. Profile on target hardware; the available documentation does not establish a single performance result for all projects.

Or skip the browser setup

Unity’s APIs capture images from your running project. If your goal is instead a screenshot of a website, ScreenshotNeo is a website screenshot API and MCP server. Its one-call API can return an image or PDF; cookie banners, popups, and chat widgets are removed before the shot, and bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and 1,000 screenshots per month are free with no card; paid plans start at $5 for 3,000.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. Sign up for the free plan to get 1,000 screenshots a month with no card.

Frequently Asked Questions

Does CaptureScreenshot save a JPEG?

The documented ScreenCapture.CaptureScreenshot method saves a PNG file.

Can I capture a camera at a different size than the screen?

Yes. Render the camera to a RenderTexture created at the dimensions you need, then read its pixels.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does a 4× superSize image contain 16× more pixels?

Yes. It is four times the width and four times the height, which yields 16 times the pixel count.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.