# Set

> Sets the bit at an index to 0 or 1.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Collections.LowLevel.Unsafe](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe.md)
* **Assembly:** UnityEngine.ManagedKernelModule

## Set(ulong\*, int, bool)

Sets the bit at an index to 0 or 1.

```csharp
public static void Set(ulong* ptr, int pos, bool value)
```

### Parameters

**** (\[ulong\*]\(https\://learn.microsoft.com/dotnet/api/system.uint64)): pointer to the bit buffer**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Index of the bit to set.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): True for 1, false for 0.

## Set(int, bool)

Sets the bit at an index to 0 or 1.

```csharp
public void Set(int pos, bool value)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Index of the bit to set.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): True for 1, false for 0.
