# AddCommandBuffer

> Add a command buffer to be executed at a specified place.

## Definition

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

## AddCommandBuffer(LightEvent, CommandBuffer)

Add a command buffer to be executed at a specified place.

```csharp
public void AddCommandBuffer(LightEvent evt, CommandBuffer buffer)
```

### Parameters

**** (\[LightEvent]\(/engine/6000.7/script-reference/unityengine/rendering/lightevent)): When to execute the command buffer during rendering.**** (\[CommandBuffer]\(/engine/6000.7/script-reference/unityengine/rendering/commandbuffer)): The buffer to execute.

### Remarks

Multiple command buffers can be set to execute at the same light event (or even the same buffer can be added multiple times). To remove command buffer from execution, use [Light.RemoveCommandBuffer](/engine/6000.7/script-reference/unityengine/light/removecommandbuffer.md).

Passing a shadow pass mask allows detailed control over which shadow passes will execute the buffer.

**Important**: This API is compatible only with the Built-In Render Pipeline.

Additional Resources: [CommandBuffer](/engine/6000.7/script-reference/unityengine/rendering/commandbuffer.md), [ShadowMapPass](/engine/6000.7/script-reference/unityengine/rendering/shadowmappass.md), [Light.RemoveCommandBuffer](/engine/6000.7/script-reference/unityengine/light/removecommandbuffer.md), [Light.GetCommandBuffers](/engine/6000.7/script-reference/unityengine/light/getcommandbuffers.md).

## AddCommandBuffer(LightEvent, CommandBuffer, ShadowMapPass)

Add a command buffer to be executed at a specified place.

```csharp
public void AddCommandBuffer(LightEvent evt, CommandBuffer buffer, ShadowMapPass shadowPassMask)
```

### Parameters

**** (\[LightEvent]\(/engine/6000.7/script-reference/unityengine/rendering/lightevent)): When to execute the command buffer during rendering.**** (\[CommandBuffer]\(/engine/6000.7/script-reference/unityengine/rendering/commandbuffer)): The buffer to execute.**** (\[ShadowMapPass]\(/engine/6000.7/script-reference/unityengine/rendering/shadowmappass)): A mask specifying which shadow passes to execute the buffer for.

### Remarks

Multiple command buffers can be set to execute at the same light event (or even the same buffer can be added multiple times). To remove command buffer from execution, use [Light.RemoveCommandBuffer](/engine/6000.7/script-reference/unityengine/light/removecommandbuffer.md).

Passing a shadow pass mask allows detailed control over which shadow passes will execute the buffer.

**Important**: This API is compatible only with the Built-In Render Pipeline.

Additional Resources: [CommandBuffer](/engine/6000.7/script-reference/unityengine/rendering/commandbuffer.md), [ShadowMapPass](/engine/6000.7/script-reference/unityengine/rendering/shadowmappass.md), [Light.RemoveCommandBuffer](/engine/6000.7/script-reference/unityengine/light/removecommandbuffer.md), [Light.GetCommandBuffers](/engine/6000.7/script-reference/unityengine/light/getcommandbuffers.md).
