# EnsureTextCapacity(int)

> Pre-allocates the internal text buffer so that subsequent TextElement.SetText (and related) calls of up to capacity UTF-16 code units do not allocate.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.7/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

```csharp
public void EnsureTextCapacity(int capacity)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The minimum buffer capacity, in UTF-16 code units.

### Remarks

The buffer grows automatically on demand using a doubling strategy, so this method is never required for correctness. Use it only to pay the allocation cost up front.
