Documentation

Unity Engine


Unity Engine


Create

Creates a blob asset from a pointer to data and a specified size.
Read time 2 minutesLast updated 3 days ago

Definition

  • Type: Method
  • Namespace: Unity.Entities
  • Assembly: UnityEngine.EntitiesModule

Create(void*, int)

Creates a blob asset from a pointer to data and a specified size.
public static BlobAssetReference<T> Create(void* ptr, int length)

Parameters

A pointer to the buffer containing the data to store in the blob asset.

length

The length of the buffer in bytes.

Returns

Type

Description

BlobAssetReference<T>A reference to newly created blob asset.

Remarks

The blob asset is created in unmanaged memory. Call BlobAssetReference<T>.Dispose 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
Additional Resources: BlobBuilder

Create(byte[])

Creates a blob asset from a byte array.
public static BlobAssetReference<T> Create(byte[] data)

Parameters

data

The byte array containing the data to store in the blob asset.

Returns

Type

Description

BlobAssetReference<T>A reference to newly created blob asset.

Remarks

The blob asset is created in unmanaged memory. Call BlobAssetReference<T>.Dispose 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
Additional Resources: BlobBuilder

Create(T)

Creates a blob asset from an instance of a struct.
public static BlobAssetReference<T> Create(T value)

Parameters

value

T
An instance of
T
.

Returns

Type

Description

BlobAssetReference<T>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 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
Additional Resources: BlobBuilder