Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

BlobAssetReference<T0>.Create

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

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

Parameters

Parameter Description
ptr A pointer to the buffer containing the data to store in the blob asset.
length The length of the buffer in bytes.

Returns

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

Description

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

The blob asset is created in unmanaged memory. Call BlobAssetReference<T0>.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


Declaration

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

Parameters

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

Returns

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

Description

Creates a blob asset from a byte array.

The blob asset is created in unmanaged memory. Call BlobAssetReference<T0>.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


Declaration

public static BlobAssetReference<T> Create(T value);

Parameters

Parameter Description
value An instance of T.

Returns

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

Description

Creates a blob asset from an instance of a struct.

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<T0>.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