Method Create
Create(void*, int)
Creates a blob asset from a pointer to data and a specified size.
Declaration
public static BlobAssetReference<T> Create(void* ptr, int length)
Parameters
Type | Name | Description |
---|---|---|
void* | ptr | A pointer to the buffer containing the data to store in the blob asset. |
int | 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 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
See Also
Create(byte[])
Creates a blob asset from a byte array.
Declaration
public static BlobAssetReference<T> Create(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
byte[] | 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 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
See Also
Create(T)
Creates a blob asset from an instance of a struct.
Declaration
public static BlobAssetReference<T> Create(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | An instance of |
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 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