# SetRenderTarget

> Add a "set active render target" command.

## Definition

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

## SetRenderTarget(RenderTargetIdentifier)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetIdentifier rt)
```

### Parameters

**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set for both color & depth buffers.

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).

## SetRenderTarget(RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetIdentifier rt, RenderBufferLoadAction loadAction, RenderBufferStoreAction storeAction)
```

### Parameters

**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set for both color & depth buffers.**** (\[RenderBufferLoadAction]\(/engine/6000.6/script-reference/unityengine/rendering/renderbufferloadaction)): Load action that is used for color and depth/stencil buffers.**** (\[RenderBufferStoreAction]\(/engine/6000.6/script-reference/unityengine/rendering/renderbufferstoreaction)): Store action that is used for color and depth/stencil buffers.

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).

## SetRenderTarget(RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, RenderBufferLoadAction, RenderBufferStoreAction)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetIdentifier rt, RenderBufferLoadAction colorLoadAction, RenderBufferStoreAction colorStoreAction, RenderBufferLoadAction depthLoadAction, RenderBufferStoreAction depthStoreAction)
```

### Parameters

**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set for both color & depth buffers.**** (\[RenderBufferLoadAction]\(/engine/6000.6/script-reference/unityengine/rendering/renderbufferloadaction)): Load action that is used for the color buffer.**** (\[RenderBufferStoreAction]\(/engine/6000.6/script-reference/unityengine/rendering/renderbufferstoreaction)): Store action that is used for the color buffer.**** (\[RenderBufferLoadAction]\(/engine/6000.6/script-reference/unityengine/rendering/renderbufferloadaction)): Load action that is used for the depth/stencil buffer.**** (\[RenderBufferStoreAction]\(/engine/6000.6/script-reference/unityengine/rendering/renderbufferstoreaction)): Store action that is used for the depth/stencil buffer.

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).

## SetRenderTarget(RenderTargetIdentifier, int)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetIdentifier rt, int mipLevel)
```

### Parameters

**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set for both color & depth buffers.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The mip level of the render target to render into.

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).

## SetRenderTarget(RenderTargetIdentifier, int, CubemapFace)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetIdentifier rt, int mipLevel, CubemapFace cubemapFace)
```

### Parameters

**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set for both color & depth buffers.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The mip level of the render target to render into.**** (\[CubemapFace]\(/engine/6000.6/script-reference/unityengine/cubemapface)): The cubemap face of a cubemap render target to render into.

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).

## SetRenderTarget(RenderTargetIdentifier, int, CubemapFace, int)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetIdentifier rt, int mipLevel, CubemapFace cubemapFace, int depthSlice)
```

### Parameters

**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set for both color & depth buffers.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The mip level of the render target to render into.**** (\[CubemapFace]\(/engine/6000.6/script-reference/unityengine/cubemapface)): The cubemap face of a cubemap render target to render into.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Slice of a 3D or array render target to set.

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).

## SetRenderTarget(RenderTargetIdentifier, RenderTargetIdentifier)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetIdentifier color, RenderTargetIdentifier depth)
```

### Parameters

**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set as a color buffer.**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set as a depth buffer.

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).

## SetRenderTarget(RenderTargetIdentifier, RenderTargetIdentifier, int)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetIdentifier color, RenderTargetIdentifier depth, int mipLevel)
```

### Parameters

**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set as a color buffer.**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set as a depth buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The mip level of the render target to render into.

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).

## SetRenderTarget(RenderTargetIdentifier, RenderTargetIdentifier, int, CubemapFace)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetIdentifier color, RenderTargetIdentifier depth, int mipLevel, CubemapFace cubemapFace)
```

### Parameters

**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set as a color buffer.**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set as a depth buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The mip level of the render target to render into.**** (\[CubemapFace]\(/engine/6000.6/script-reference/unityengine/cubemapface)): The cubemap face of a cubemap render target to render into.

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).

## SetRenderTarget(RenderTargetIdentifier, RenderTargetIdentifier, int, CubemapFace, int)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetIdentifier color, RenderTargetIdentifier depth, int mipLevel, CubemapFace cubemapFace, int depthSlice)
```

### Parameters

**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set as a color buffer.**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set as a depth buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The mip level of the render target to render into.**** (\[CubemapFace]\(/engine/6000.6/script-reference/unityengine/cubemapface)): The cubemap face of a cubemap render target to render into.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Slice of a 3D or array render target to set.

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).

## SetRenderTarget(RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetIdentifier color, RenderBufferLoadAction colorLoadAction, RenderBufferStoreAction colorStoreAction, RenderTargetIdentifier depth, RenderBufferLoadAction depthLoadAction, RenderBufferStoreAction depthStoreAction)
```

### Parameters

**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set as a color buffer.**** (\[RenderBufferLoadAction]\(/engine/6000.6/script-reference/unityengine/rendering/renderbufferloadaction)): Load action that is used for the color buffer.**** (\[RenderBufferStoreAction]\(/engine/6000.6/script-reference/unityengine/rendering/renderbufferstoreaction)): Store action that is used for the color buffer.**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set as a depth buffer.**** (\[RenderBufferLoadAction]\(/engine/6000.6/script-reference/unityengine/rendering/renderbufferloadaction)): Load action that is used for the depth/stencil buffer.**** (\[RenderBufferStoreAction]\(/engine/6000.6/script-reference/unityengine/rendering/renderbufferstoreaction)): Store action that is used for the depth/stencil buffer.

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).

## SetRenderTarget(RenderTargetIdentifier\[], RenderTargetIdentifier)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetIdentifier[] colors, RenderTargetIdentifier depth)
```

### Parameters

**** (\[RenderTargetIdentifier\[]]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render targets to set as color buffers (MRT).**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set as a depth buffer.

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).

## SetRenderTarget(RenderTargetIdentifier\[], RenderTargetIdentifier, int, CubemapFace, int)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetIdentifier[] colors, RenderTargetIdentifier depth, int mipLevel, CubemapFace cubemapFace, int depthSlice)
```

### Parameters

**** (\[RenderTargetIdentifier\[]]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render targets to set as color buffers (MRT).**** (\[RenderTargetIdentifier]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier)): Render target to set as a depth buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The mip level of the render target to render into.**** (\[CubemapFace]\(/engine/6000.6/script-reference/unityengine/cubemapface)): The cubemap face of a cubemap render target to render into.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Slice of a 3D or array render target to set.

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).

## SetRenderTarget(RenderTargetBinding, int, CubemapFace, int)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetBinding binding, int mipLevel, CubemapFace cubemapFace, int depthSlice)
```

### Parameters

**** (\[RenderTargetBinding]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetbinding)): **** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The mip level of the render target to render into.**** (\[CubemapFace]\(/engine/6000.6/script-reference/unityengine/cubemapface)): The cubemap face of a cubemap render target to render into.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Slice of a 3D or array render target to set.

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).

## SetRenderTarget(RenderTargetBinding)

Add a "set active render target" command.

```csharp
public void SetRenderTarget(RenderTargetBinding binding)
```

### Parameters

**** (\[RenderTargetBinding]\(/engine/6000.6/script-reference/unityengine/rendering/rendertargetbinding)):&#x20;

### Remarks

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), or one of built-in temporary textures ([BuiltinRenderTextureType](/engine/6000.6/script-reference/unityengine/rendering/builtinrendertexturetype.md)). All that is expressed by a [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md) struct, which has implicit conversion operators to save on typing.

You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md). Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.

Note that in Linear color space, it is important to have the correct sRGB\<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting [GL.sRGBWrite](/engine/6000.6/script-reference/unityengine/gl/srgbwrite.md) as you need it before doing SetRenderTarget or any other manual rendering.

Clear is currently not supported. A subsequent call to [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md) has the same effect and is optimized on graphics APIs that support `clear` load actions.

Additional Resources: [CommandBuffer.GetTemporaryRT](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/gettemporaryrt.md), [CommandBuffer.ClearRenderTarget](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/clearrendertarget.md), [CommandBuffer.Blit](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/blit.md), [RenderTargetIdentifier](/engine/6000.6/script-reference/unityengine/rendering/rendertargetidentifier.md).
