# SetComputeConstantBufferParam

> Adds a command to set a constant buffer on a ComputeShader.

## Definition

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

## SetComputeConstantBufferParam(ComputeShader, int, ComputeBuffer, int, int)

Adds a command to set a constant buffer on a [ComputeShader](/engine/6000.7/script-reference/unityengine/computeshader.md).

```csharp
public void SetComputeConstantBufferParam(ComputeShader computeShader, int nameID, ComputeBuffer buffer, int offset, int size)
```

### Parameters

**** (\[ComputeShader]\(/engine/6000.7/script-reference/unityengine/computeshader)): The [ComputeShader](/engine/6000.7/script-reference/unityengine/computeshader.md) to set parameter for.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The ID of the property name for the constant buffer in shader code. Use [Shader.PropertyToID](/engine/6000.7/script-reference/unityengine/shader/propertytoid.md) to get this ID.**** (\[ComputeBuffer]\(/engine/6000.7/script-reference/unityengine/computebuffer)): The buffer to bind as constant buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The offset in bytes from the beginning of the buffer to bind. Must be a multiple of [SystemInfo.constantBufferOffsetAlignment](/engine/6000.7/script-reference/unityengine/systeminfo/constantbufferoffsetalignment.md), or 0 if that value is 0.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of bytes to bind.

### Remarks

See [ComputeShader.SetConstantBuffer](/engine/6000.7/script-reference/unityengine/computeshader/setconstantbuffer.md) for usage.

## SetComputeConstantBufferParam(ComputeShader, string, ComputeBuffer, int, int)

Adds a command to set a constant buffer on a [ComputeShader](/engine/6000.7/script-reference/unityengine/computeshader.md).

```csharp
public void SetComputeConstantBufferParam(ComputeShader computeShader, string name, ComputeBuffer buffer, int offset, int size)
```

### Parameters

**** (\[ComputeShader]\(/engine/6000.7/script-reference/unityengine/computeshader)): The [ComputeShader](/engine/6000.7/script-reference/unityengine/computeshader.md) to set parameter for.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the constant buffer in shaders code.**** (\[ComputeBuffer]\(/engine/6000.7/script-reference/unityengine/computebuffer)): The buffer to bind as constant buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The offset in bytes from the beginning of the buffer to bind. Must be a multiple of [SystemInfo.constantBufferOffsetAlignment](/engine/6000.7/script-reference/unityengine/systeminfo/constantbufferoffsetalignment.md), or 0 if that value is 0.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of bytes to bind.

### Remarks

See [ComputeShader.SetConstantBuffer](/engine/6000.7/script-reference/unityengine/computeshader/setconstantbuffer.md) for usage.

## SetComputeConstantBufferParam(ComputeShader, int, GraphicsBuffer, int, int)

Adds a command to set a constant buffer on a [ComputeShader](/engine/6000.7/script-reference/unityengine/computeshader.md).

```csharp
public void SetComputeConstantBufferParam(ComputeShader computeShader, int nameID, GraphicsBuffer buffer, int offset, int size)
```

### Parameters

**** (\[ComputeShader]\(/engine/6000.7/script-reference/unityengine/computeshader)): The [ComputeShader](/engine/6000.7/script-reference/unityengine/computeshader.md) to set parameter for.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The ID of the property name for the constant buffer in shader code. Use [Shader.PropertyToID](/engine/6000.7/script-reference/unityengine/shader/propertytoid.md) to get this ID.**** (\[GraphicsBuffer]\(/engine/6000.7/script-reference/unityengine/graphicsbuffer)): The buffer to bind as constant buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The offset in bytes from the beginning of the buffer to bind. Must be a multiple of [SystemInfo.constantBufferOffsetAlignment](/engine/6000.7/script-reference/unityengine/systeminfo/constantbufferoffsetalignment.md), or 0 if that value is 0.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of bytes to bind.

### Remarks

See [ComputeShader.SetConstantBuffer](/engine/6000.7/script-reference/unityengine/computeshader/setconstantbuffer.md) for usage.

## SetComputeConstantBufferParam(ComputeShader, string, GraphicsBuffer, int, int)

Adds a command to set a constant buffer on a [ComputeShader](/engine/6000.7/script-reference/unityengine/computeshader.md).

```csharp
public void SetComputeConstantBufferParam(ComputeShader computeShader, string name, GraphicsBuffer buffer, int offset, int size)
```

### Parameters

**** (\[ComputeShader]\(/engine/6000.7/script-reference/unityengine/computeshader)): The [ComputeShader](/engine/6000.7/script-reference/unityengine/computeshader.md) to set parameter for.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the constant buffer in shaders code.**** (\[GraphicsBuffer]\(/engine/6000.7/script-reference/unityengine/graphicsbuffer)): The buffer to bind as constant buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The offset in bytes from the beginning of the buffer to bind. Must be a multiple of [SystemInfo.constantBufferOffsetAlignment](/engine/6000.7/script-reference/unityengine/systeminfo/constantbufferoffsetalignment.md), or 0 if that value is 0.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of bytes to bind.

### Remarks

See [ComputeShader.SetConstantBuffer](/engine/6000.7/script-reference/unityengine/computeshader/setconstantbuffer.md) for usage.
