文档

Unity Engine

Unity Engine

BufferTypeHandle<T>

A handle to a specific buffer component type, used to access an ArchetypeChunk 's component data in a job.
阅读时间1 分钟最后更新于 19 天前

Definition

  • Type: Struct
  • Namespace: Unity.Entities
  • Assembly: UnityEngine.EntitiesModule
public struct BufferTypeHandle<T> where T : unmanaged, IBufferElementData

Remarks

Passing a type handle to a job automatically registers the job as a reader or writer of that type, which allows the DOTS safety system to detect potential race conditions between concurrent jobs which access the same component type.
To create a BufferTypeHandle, use ComponentSystemBase.GetBufferTypeHandle. While type handles can be created just in time before they're used, it is more efficient to create them once during system creation, cache them in a private field on the system, and incrementally update them with BufferTypeHandle<T>.Update just before use.
If the component type is not known at compile time, use DynamicComponentTypeHandle.

Properties

Property

Description

GlobalSystemVersionThe global system version for which this handle is valid.
IsReadOnlyReports whether this type handle was created in read-only mode.

Methods

Method

Description

ToFixedStringReturns the formatted FixedString "BufferTypeHandle[type_name_here]".
UpdateWhen a BufferTypeHandle is cached by a system across multiple system updates, calling this function inside the system's OnUpdate() method performs the minimal incremental updates necessary to make the type handle safe to use.