# CaptureScreenshotIntoRenderTexture(RenderTexture)

> Captures a screenshot of the game view into a RenderTexture object.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.ScreenCaptureModule

```csharp
public static void CaptureScreenshotIntoRenderTexture(RenderTexture renderTexture)
```

### Parameters

**** (\[RenderTexture]\(/engine/6000.0/script-reference/unityengine/rendertexture)): RenderTexture that will get filled with the screen content.

### Remarks

This variant of screen capture makes it possible to read pixels asynchronously using [AsyncGPUReadback](/engine/6000.0/script-reference/unityengine/rendering/asyncgpureadback.md), making the process consume less time on the main thread.

**Important**: To ensure reliable results, always wait until the frame rendering process is complete before calling this method. To guarantee this, you can call it from a coroutine that yields on [WaitForEndOfFrame](/engine/6000.0/script-reference/unityengine/waitforendofframe.md).

### Examples

```csharp
using UnityEngine;
using System.Collections;
using UnityEngine.Rendering;

public class ScreenCaptureIntoRenderTexture : MonoBehaviour
{
    private RenderTexture renderTexture;

    IEnumerator Start()
    {
        yield return new WaitForEndOfFrame();

        renderTexture = new RenderTexture(Screen.width, Screen.height, 0);
        ScreenCapture.CaptureScreenshotIntoRenderTexture(renderTexture);
        AsyncGPUReadback.Request(renderTexture, 0, TextureFormat.RGBA32, ReadbackCompleted);
    }

    void ReadbackCompleted(AsyncGPUReadbackRequest request)
    {
        // Render texture no longer needed, it has been read back.
        DestroyImmediate(renderTexture);

        using (var imageBytes = request.GetData<byte>())
        {
            // do something with the pixel data.
        }
    }
}
```
