Documentation

Unity Engine


Unity Engine


TransformLookup

A [NativeContainer] that provides access to all instances of TransformRef components, indexed by Entity.
Read time 2 minutesLast updated 2 days ago

Definition

  • Type: Struct
  • Namespace: Unity.Entities
  • Assembly: UnityEngine.EntitiesModule
public struct TransformLookup

Remarks

TransformLookup is a native container that provides array-like access to TransformRef components. For example, while iterating over a set of entities, you can use TransformLookup to get and set the transforms of unrelated entities.
To get a TransformLookup, call SystemState.GetTransformLookup.
Pass a TransformLookup container to a job by defining a public field of the appropriate type in your IJob implementation. You can safely read from TransformLookup in any job, but by default, you cannot write to components in the container in parallel jobs (including IJobEntity, SystemAPI.Query and IJobChunk). If you know that two instances of a parallel job can never write to the same index in the container, you can disable the restriction on parallel writing by adding NativeDisableParallelForRestrictionAttribute to the TransformLookup field definition in the job struct.

Properties

Property

Description

this[]Gets the TransformRef instance for the specified entity.

Methods

Method

Description

DidChangeReports whether any of TransformRef components in the chunk containing the specified Entity could have changed since a previous version.
EntityExistsReports whether the specified entity exists. Does not consider whether a TransformRef exists on the given entity.
HasTransformReports whether the specified Entity instance still refers to a valid entity and that it has a transform component.
TryGetTransformRetrieves the transform components associated with the specified Entity, if it exists. The return value indicates whether the component was successfully retrieved.
UpdateWhen a TransformLookup 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 lookup safe to use.