# Create

> Creates a blob asset from a pointer to data and a specified size.

## Definition

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

## Create(void\*, int)

Creates a blob asset from a pointer to data and a specified size.

```csharp
public static BlobAssetReference<T> Create(void* ptr, int length)
```

### Parameters

**** (\[void\*]\(https\://learn.microsoft.com/dotnet/api/system.void)): A pointer to the buffer containing the data to store in the blob asset.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The length of the buffer in bytes.

### Returns

| Type                                                                                            | Description                              |
| ----------------------------------------------------------------------------------------------- | ---------------------------------------- |
| [BlobAssetReference\<T>](/engine/7000.0/script-reference/unity/entities/blobassetreference1.md) | A reference to newly created blob asset. |

### Remarks

The blob asset is created in unmanaged memory. Call [BlobAssetReference\<T>.Dispose](/engine/7000.0/script-reference/unity/entities/blobassetreference1/dispose.md) to free the asset memory when it is no longer needed. This function can only be used in an \[unsafe context]. \[unsafe context]: [https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/unsafe-code](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/unsafe-code)

Additional Resources: [BlobBuilder](/engine/7000.0/script-reference/unity/entities/blobbuilder.md)

## Create(byte\[])

Creates a blob asset from a byte array.

```csharp
public static BlobAssetReference<T> Create(byte[] data)
```

### Parameters

**** (\[byte\[]]\(https\://learn.microsoft.com/dotnet/api/system.byte)): The byte array containing the data to store in the blob asset.

### Returns

| Type                                                                                            | Description                              |
| ----------------------------------------------------------------------------------------------- | ---------------------------------------- |
| [BlobAssetReference\<T>](/engine/7000.0/script-reference/unity/entities/blobassetreference1.md) | A reference to newly created blob asset. |

### Remarks

The blob asset is created in unmanaged memory. Call [BlobAssetReference\<T>.Dispose](/engine/7000.0/script-reference/unity/entities/blobassetreference1/dispose.md) to free the asset memory when it is no longer needed. This function can only be used in an \[unsafe context]. \[unsafe context]: [https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/unsafe-code](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/unsafe-code)

Additional Resources: [BlobBuilder](/engine/7000.0/script-reference/unity/entities/blobbuilder.md)

## Create(T)

Creates a blob asset from an instance of a struct.

```csharp
public static BlobAssetReference<T> Create(T value)
```

### Parameters

**** (T): An instance of `T`.

### Returns

| Type                                                                                            | Description                              |
| ----------------------------------------------------------------------------------------------- | ---------------------------------------- |
| [BlobAssetReference\<T>](/engine/7000.0/script-reference/unity/entities/blobassetreference1.md) | A reference to newly created blob asset. |

### Remarks

The struct must only contain blittable fields (primitive types, fixed-length arrays, or other structs meeting these same criteria). The blob asset is created in unmanaged memory. Call [BlobAssetReference\<T>.Dispose](/engine/7000.0/script-reference/unity/entities/blobassetreference1/dispose.md) to free the asset memory when it is no longer needed. This function can only be used in an \[unsafe context]. \[unsafe context]: [https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/unsafe-code](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/unsafe-code)

Additional Resources: [BlobBuilder](/engine/7000.0/script-reference/unity/entities/blobbuilder.md)
