# AllocateString

> Allocates memory to store the string in a blob asset and copies the string data into it.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule

## AllocateString(BlobBuilder, BlobString, string)

Allocates memory to store the string in a blob asset and copies the string data into it.

```csharp
public static void AllocateString(this ref BlobBuilder builder, ref BlobString blobStr, string value)
```

### Parameters

**** (\[BlobBuilder]\(/engine/7000.0/script-reference/unity/entities/blobbuilder)): The BlobBuilder instance building the blob asset.**** (\[BlobString]\(/engine/7000.0/script-reference/unity/entities/blobstring)): A reference to the field in the blob asset that will store the string. This function allocates memory for that field and sets the string value.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The string to copy into the blob asset.

## AllocateString\<T>(BlobBuilder, BlobString, T)

Allocates memory to store the string in a blob asset and copies the string data into it.

```csharp
public static void AllocateString<T>(this ref BlobBuilder builder, ref BlobString blobStr, ref T value) where T : INativeList<byte>
```

### Parameters

**** (\[BlobBuilder]\(/engine/7000.0/script-reference/unity/entities/blobbuilder)): The BlobBuilder instance building the blob asset.**** (\[BlobString]\(/engine/7000.0/script-reference/unity/entities/blobstring)): A reference to the field in the blob asset that will store the string. This function allocates memory for that field and sets the string value.**** (T): The string to copy into the blob asset.
