Struct BlobBuilder
Creates blob assets.
Namespace: Unity.Entities
Assembly: solution.dll
Syntax
public struct BlobBuilder
Remarks
A blob asset is an immutable data structure stored in unmanaged memory.
Blob assets can contain primitive types, strings, structs, arrays, and arrays of arrays. Arrays and structs
must only contain blittable types. Strings must be of type Blob
To use a BlobBuilder object to create a blob asset:
- Declare the structure of the blob asset as a struct.
- Create a BlobBuilder object.
- Call the Construct
Root<T>() method, whereT
is the struct defining the asset structure. - Initialize primitive values defined at the root level of the asset.
- Allocate memory for arrays, structs, and Blob
String instances at the root. - Initialize the values of those arrays, structs, and strings.
- Continue allocating memory and initializing values until you have fully constructed the asset.
- Call Create
Blob to create a reference to the blob asset in memory.Asset Reference<T>(Allocator Handle) - Dispose the BlobBuilder object.
Use the Blob
Call Dispose() to free the memory allocated for a blob asset.
Blob assets cannot be modified once created. Instead, you must create a new blob asset, update any references to the old one and then dispose of it.
Examples
Constructors
Name | Description |
---|---|
Blob |
Constructs a BlobBuilder object. |
Properties
Name | Description |
---|---|
Is |
Returns true if this BlobBuilder has been allocated. |
Methods
Name | Description |
---|---|
Allocate<T>(ref Blob |
Allocates enough memory to store |
Allocate<T>(ref Blob |
Allocates enough memory to store |
Allocate<T>(ref Blob |
Allocates enough memory to store a struct of type |
Construct |
Creates the top-level fields of a single blob asset. |
Construct<T>(ref Blob |
Copies an array of structs to an array in a blob asset after allocating the necessary memory. |
Create |
Completes construction of the blob asset and returns a reference to the asset in unmanaged memory. |
Dispose() | Disposes of this BlobBuilder instance and frees its temporary memory allocations. |
Set |
Sets a BlobPtr to point to the given object inside the blob. |