# Constant

> ComputeBuffer that you can use as a constant buffer (uniform buffer).

## Definition

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

```csharp
Constant = 8
```

### Remarks

If you use this flag, you can use the [ComputeBuffer](/engine/6000.0/script-reference/unityengine/computebuffer.md) as a parameter to [ComputeShader.SetConstantBuffer](/engine/6000.0/script-reference/unityengine/computeshader/setconstantbuffer.md) and [Material.SetConstantBuffer](/engine/6000.0/script-reference/unityengine/material/setconstantbuffer.md). If you also need the buffer to be bound as a structured buffer, you must add the StructuredBuffer flag. Some renderers (such as DX11) do not support binding buffers as both constant and structured buffers.

The data layout of a shader's constant buffer may be different depending on the graphics API. This means [ComputeShader.SetConstantBuffer](/engine/6000.0/script-reference/unityengine/computeshader/setconstantbuffer.md) or [Material.SetConstantBuffer](/engine/6000.0/script-reference/unityengine/material/setconstantbuffer.md) might overwrite data or set variables to the wrong values. See [Writing shaders for different graphics APIs](/engine/6000.0/manual/materials-and-shaders/shaders/writing-custom/shader-writing/sl/writing-shader-writing-shader-programs-hlsl/sl-platform-differences.md) for more information.
