Struct BlobAssetComputationContext<TS, TB>
The BlobAssetComputationContext must be used during Authoring to ECS conversion process to detect which BlobAsset should be computed and to declare their association with a UnityObject
Namespace: Unity.Entities
Syntax
public struct BlobAssetComputationContext<TS, TB> : IDisposable where TS : struct where TB : struct
Type Parameters
Name | Description |
---|---|
TS | The type of the setting struct to be used to generate the BlobAsset |
TB | The type of the BlobAsset to generate |
Remarks
The context must typically be used in a three stages conversion process, for given type of BlobAsset to process. Multiple context can be used if multiple BlobAsset types are generated. Stages: 1) Each Authoring component to convert are evaluated> The user calls AssociateBlobAssetWithUnityObject(Hash128, Object) to declare the association between the UnityObject owning the Authoring component and the BlobAsset being processed. Then NeedToComputeBlobAsset(Hash128) is called to determine if the BlobAsset needs to be computed or if it's already in the store (or registered for computation). The user creates the setting object that contains the necessary information to create the BlobAsset later on and calls AddBlobAssetToCompute(Hash128, TS). 2) The user creates a job to compute all BlobAsset and calls GetSettings(Allocator) to feed the job with the settings of each BlobAsset to compute. During the job execution, the BlobAsset will be created and typically stored in a result array. After the job is done, the user must call AddComputedBlobAsset(Hash128, BlobAssetReference<TB>) to add the newly created BlobAsset to the context (and the Store) 3) The user create ECS Components and attaches the BlobAsset by callingGetBlobAsset(Hash128, out BlobAssetReference<TB>). When the context will be disposed (typically after the conversion process is done), the store will be updated with the new associations between the BlobAsset and the UnityObject(s) that use them. If a BlobAsset is no longer used by any UnityObject, it will be disposed. Thread-safety: main thread only.
Constructors
Name | Description |
---|---|
BlobAssetComputationContext(BlobAssetStore, Int32, Allocator) |
Properties
Name | Description |
---|---|
IsCreated |
Methods
Name | Description |
---|---|
AddBlobAssetToCompute(Hash128, TS) | Call this method to record a setting object that will be used to compute a BlobAsset |
AddComputedBlobAsset(Hash128, BlobAssetReference<TB>) | Add a newly created BlobAsset in the context and its Store. |
AssociateBlobAssetWithUnityObject(Hash128, Object) | Declare the BlobAsset being associated with the given UnityObject |
Dispose() | Dispose the Computation context, update the BlobAssetStore with the new BlobAsset/UnityObject associations |
GetBlobAsset(Hash128, out BlobAssetReference<TB>) | Get the blob asset for the corresponding hash |
GetSettings(Allocator) | |
NeedToComputeBlobAsset(Hash128) | During the conversion process, the user must call this method for each BlobAsset being processed, to determine if it requires to be computed |
UpdateBlobStore() | Update the store with the recorded BlobAsset/UnityObject associations. |