# SetCounterValue(uint)

> Sets counter value of append/consume buffer.

## Definition

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

```csharp
public void SetCounterValue(uint counterValue)
```

### Parameters

**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): Value of the append/consume counter.

### Remarks

Append/consume and counter buffers (see [ComputeBufferType.Append](/engine/6000.5/script-reference/unityengine/computebuffertype/append.md), [ComputeBufferType.Counter](/engine/6000.5/script-reference/unityengine/computebuffertype/counter.md)) keep track of the number of elements in them with a special counter variable. SetCounterValue explicitly sets the counter value.

This can be used to reset the counter or to set it to a specific value.

Note: SetCounterValue can not be called while the buffer is bound via [Graphics.SetRandomWriteTarget](/engine/6000.5/script-reference/unityengine/graphics/setrandomwritetarget.md).

Additional Resources: [ComputeBuffer.CopyCount](/engine/6000.5/script-reference/unityengine/computebuffer/copycount.md), [Graphics.SetRandomWriteTarget](/engine/6000.5/script-reference/unityengine/graphics/setrandomwritetarget.md).
