# Blit

> Uses a shader to copy the pixel data from a texture into a render target.

## Definition

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

## Blit(Texture, RenderTexture)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, RenderTexture dest)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[RenderTexture]\(/engine/6000.0/script-reference/unityengine/rendertexture)): The destination [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) or [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md).

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, RenderTexture, int, int)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, RenderTexture dest, int sourceDepthSlice, int destDepthSlice)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[RenderTexture]\(/engine/6000.0/script-reference/unityengine/rendertexture)): The destination [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) or [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md).**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the source texture to copy from, for example the texture in a texture array. You can't use `sourceDepthSlice` to specify a face in a Cubemap.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the destination texture to copy from, for example the texture in a texture array. You can't use `destDepthSlice` to specify a face in a Cubemap.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, RenderTexture, Vector2, Vector2)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, RenderTexture dest, Vector2 scale, Vector2 offset)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[RenderTexture]\(/engine/6000.0/script-reference/unityengine/rendertexture)): The destination [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) or [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md).**** (\[Vector2]\(/engine/6000.0/script-reference/unityengine/vector2)): The scale to apply.**** (\[Vector2]\(/engine/6000.0/script-reference/unityengine/vector2)): The offset to apply.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, RenderTexture, Vector2, Vector2, int, int)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, RenderTexture dest, Vector2 scale, Vector2 offset, int sourceDepthSlice, int destDepthSlice)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[RenderTexture]\(/engine/6000.0/script-reference/unityengine/rendertexture)): The destination [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) or [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md).**** (\[Vector2]\(/engine/6000.0/script-reference/unityengine/vector2)): The scale to apply.**** (\[Vector2]\(/engine/6000.0/script-reference/unityengine/vector2)): The offset to apply.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the source texture to copy from, for example the texture in a texture array. You can't use `sourceDepthSlice` to specify a face in a Cubemap.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the destination texture to copy from, for example the texture in a texture array. You can't use `destDepthSlice` to specify a face in a Cubemap.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, RenderTexture, Material, int)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, RenderTexture dest, Material mat, int pass)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[RenderTexture]\(/engine/6000.0/script-reference/unityengine/rendertexture)): The destination [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) or [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md).**** (\[Material]\(/engine/6000.0/script-reference/unityengine/material)): The material to use. If you don't provide `mat`, Unity uses a default material.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): If the value is `-1`, Unity draws all the passes in `mat`. Otherwise, Unity draws only the pass you set `pass` to. The default value is `-1`.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, RenderTexture, Material, int, int)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, RenderTexture dest, Material mat, int pass, int destDepthSlice)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[RenderTexture]\(/engine/6000.0/script-reference/unityengine/rendertexture)): The destination [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) or [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md).**** (\[Material]\(/engine/6000.0/script-reference/unityengine/material)): The material to use. If you don't provide `mat`, Unity uses a default material.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): If the value is `-1`, Unity draws all the passes in `mat`. Otherwise, Unity draws only the pass you set `pass` to. The default value is `-1`.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the destination texture to copy from, for example the texture in a texture array. You can't use `destDepthSlice` to specify a face in a Cubemap.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, RenderTexture, Material)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, RenderTexture dest, Material mat)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[RenderTexture]\(/engine/6000.0/script-reference/unityengine/rendertexture)): The destination [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) or [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md).**** (\[Material]\(/engine/6000.0/script-reference/unityengine/material)): The material to use. If you don't provide `mat`, Unity uses a default material.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, Material, int)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, Material mat, int pass)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[Material]\(/engine/6000.0/script-reference/unityengine/material)): The material to use. If you don't provide `mat`, Unity uses a default material.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): If the value is `-1`, Unity draws all the passes in `mat`. Otherwise, Unity draws only the pass you set `pass` to. The default value is `-1`.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, Material, int, int)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, Material mat, int pass, int destDepthSlice)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[Material]\(/engine/6000.0/script-reference/unityengine/material)): The material to use. If you don't provide `mat`, Unity uses a default material.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): If the value is `-1`, Unity draws all the passes in `mat`. Otherwise, Unity draws only the pass you set `pass` to. The default value is `-1`.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the destination texture to copy from, for example the texture in a texture array. You can't use `destDepthSlice` to specify a face in a Cubemap.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, Material)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, Material mat)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[Material]\(/engine/6000.0/script-reference/unityengine/material)): The material to use. If you don't provide `mat`, Unity uses a default material.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, GraphicsTexture)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, GraphicsTexture dest)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[GraphicsTexture]\(/engine/6000.0/script-reference/unityengine/rendering/graphicstexture)): The destination [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) or [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md).

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, GraphicsTexture, int, int)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, GraphicsTexture dest, int sourceDepthSlice, int destDepthSlice)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[GraphicsTexture]\(/engine/6000.0/script-reference/unityengine/rendering/graphicstexture)): The destination [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) or [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md).**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the source texture to copy from, for example the texture in a texture array. You can't use `sourceDepthSlice` to specify a face in a Cubemap.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the destination texture to copy from, for example the texture in a texture array. You can't use `destDepthSlice` to specify a face in a Cubemap.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, GraphicsTexture, Vector2, Vector2)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, GraphicsTexture dest, Vector2 scale, Vector2 offset)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[GraphicsTexture]\(/engine/6000.0/script-reference/unityengine/rendering/graphicstexture)): The destination [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) or [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md).**** (\[Vector2]\(/engine/6000.0/script-reference/unityengine/vector2)): The scale to apply.**** (\[Vector2]\(/engine/6000.0/script-reference/unityengine/vector2)): The offset to apply.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, GraphicsTexture, Vector2, Vector2, int, int)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, GraphicsTexture dest, Vector2 scale, Vector2 offset, int sourceDepthSlice, int destDepthSlice)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[GraphicsTexture]\(/engine/6000.0/script-reference/unityengine/rendering/graphicstexture)): The destination [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) or [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md).**** (\[Vector2]\(/engine/6000.0/script-reference/unityengine/vector2)): The scale to apply.**** (\[Vector2]\(/engine/6000.0/script-reference/unityengine/vector2)): The offset to apply.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the source texture to copy from, for example the texture in a texture array. You can't use `sourceDepthSlice` to specify a face in a Cubemap.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the destination texture to copy from, for example the texture in a texture array. You can't use `destDepthSlice` to specify a face in a Cubemap.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, GraphicsTexture, Material, int)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, GraphicsTexture dest, Material mat, int pass)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[GraphicsTexture]\(/engine/6000.0/script-reference/unityengine/rendering/graphicstexture)): The destination [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) or [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md).**** (\[Material]\(/engine/6000.0/script-reference/unityengine/material)): The material to use. If you don't provide `mat`, Unity uses a default material.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): If the value is `-1`, Unity draws all the passes in `mat`. Otherwise, Unity draws only the pass you set `pass` to. The default value is `-1`.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, GraphicsTexture, Material, int, int)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, GraphicsTexture dest, Material mat, int pass, int destDepthSlice)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[GraphicsTexture]\(/engine/6000.0/script-reference/unityengine/rendering/graphicstexture)): The destination [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) or [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md).**** (\[Material]\(/engine/6000.0/script-reference/unityengine/material)): The material to use. If you don't provide `mat`, Unity uses a default material.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): If the value is `-1`, Unity draws all the passes in `mat`. Otherwise, Unity draws only the pass you set `pass` to. The default value is `-1`.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the destination texture to copy from, for example the texture in a texture array. You can't use `destDepthSlice` to specify a face in a Cubemap.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```

## Blit(Texture, GraphicsTexture, Material)

Uses a shader to copy the pixel data from a texture into a render target.

```csharp
public static void Blit(Texture source, GraphicsTexture dest, Material mat)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture.**** (\[GraphicsTexture]\(/engine/6000.0/script-reference/unityengine/rendering/graphicstexture)): The destination [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) or [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md).**** (\[Material]\(/engine/6000.0/script-reference/unityengine/material)): The material to use. If you don't provide `mat`, Unity uses a default material.

### Remarks

This method copies pixel data from a texture on the GPU to a render texture or graphics texture on the GPU. This is one of the fastest ways to copy a texture.

When you use `Graphics.Blit`, Unity does the following:

1. Sets the active render target to the `dest` texture. (See [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md).)
2. Passes `source` to the `mat` material as the `_MainTex` property.
3. Uses the material's shader to draw a full-screen surface from the `source` texture to the `dest` texture.

If you provide a `mat` material that doesn't have a `_MainTex` property, `Blit` doesn't use `source`. If you provide a [GraphicsTexture](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture.md) as `dest`, it must have [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled in its [GraphicsTextureDescriptor.flags](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptor/flags.md).

You can use `Graphics.Blit` to create [post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md), by setting `mat` to a material with a custom shader.

`Blit` changes [RenderTexture.active](/engine/6000.0/script-reference/unityengine/rendertexture/active.md) and [GraphicsTexture.active](/engine/6000.0/script-reference/unityengine/rendering/graphicstexture/active.md). Store the active render target before you use `Blit` if you need to use it afterwards.

Avoid setting `source` and `dest` to the same texture, as this may cause undefined behaviour. Use [Custom Render Textures](/engine/6000.0/manual/materials-and-shaders/textures/textures-reference/class-custom-render-texture.md) with double buffering instead, or use two render textures and alternate between them to implement double buffering manually.

In linear color space, set [GL.sRGBWrite](/engine/6000.0/script-reference/unityengine/gl/srgbwrite.md) before using `Blit`, to make sure the sRGB-to-linear color conversion is what you expect.

To blit to the screen in the Built-in Render Pipeline, follow these steps:

1. Set `dest` to `null`. Unity now uses `Camera.main.targetTexture` as the destination texture.
2. Set the [Camera.targetTexture](/engine/6000.0/script-reference/unityengine/camera/targettexture.md) property of [Camera.main](/engine/6000.0/script-reference/unityengine/camera/main.md) to `null`.

To blit to the screen in the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you must call [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) or [CommandBuffer.Blit](/engine/6000.0/script-reference/unityengine/rendering/commandbuffer/blit.md) inside a method that you call from the [RenderPipelineManager.endContextRendering](/engine/6000.0/script-reference/unityengine/rendering/renderpipelinemanager/endcontextrendering.md) callback.

If you want to use a depth or stencil buffer that is part of the source (Render)texture, or blit to a subregion of a texture, you have to manually write an equivalent of the [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) function - i.e. [Graphics.SetRenderTarget](/engine/6000.0/script-reference/unityengine/graphics/setrendertarget.md) with destination color buffer and source depth buffer, setup orthographic projection ([GL.LoadOrtho](/engine/6000.0/script-reference/unityengine/gl/loadortho.md)), setup material pass ([Material.SetPass](/engine/6000.0/script-reference/unityengine/material/setpass.md)) and draw a quad ([GL.Begin](/engine/6000.0/script-reference/unityengine/gl/begin.md)).

Additional Resources: [Graphics.BlitMultiTap](/engine/6000.0/script-reference/unityengine/graphics/blitmultitap.md), [Post-processing effects](/engine/6000.0/manual/post-processing-and-full-screen-effects/overview.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{ // Copies aTexture to rTex and displays it in all cameras.

    Texture aTexture;
    RenderTexture rTex;

    void Start()
    {
        if (!aTexture || !rTex)
        {
            Debug.LogError("A texture or a render texture are missing, assign them.");
        }
    }

    void Update()
    {
        Graphics.Blit(aTexture, rTex);
    }
}
```
