# UnsafeAppendBuffer

> Initializes and returns an instance of UnsafeAppendBuffer.

## Definition

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

## UnsafeAppendBuffer(int, int, AllocatorHandle)

Initializes and returns an instance of UnsafeAppendBuffer.

```csharp
public UnsafeAppendBuffer(int initialCapacity, int alignment, AllocatorManager.AllocatorHandle allocator)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The initial allocation size in bytes of the internal buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The byte alignment of the allocation. Must be a non-zero power of 2.**** (\[AllocatorHandle]\(/engine/6000.7/script-reference/unity/collections/allocatormanager/allocatorhandle)): The allocator to use.

## UnsafeAppendBuffer(void\*, int)

Initializes and returns an instance of UnsafeAppendBuffer that aliases an existing buffer.

```csharp
public UnsafeAppendBuffer(void* ptr, int length)
```

### Parameters

**** (\[void\*]\(https\://learn.microsoft.com/dotnet/api/system.void)): The buffer to alias.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The length in bytes of the buffer.

### Remarks

The capacity will be set to `length`, and [UnsafeAppendBuffer.Length](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/length.md) will be set to 0.
