# TransformLookup

> A [NativeContainer] that provides access to all instances of TransformRef components, indexed by Entity.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule

```csharp
public struct TransformLookup
```

## Remarks

TransformLookup is a native container that provides array-like access to [TransformRef](/engine/7000.0/script-reference/unity/entities/transformref.md) 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](/engine/7000.0/script-reference/unity/entities/systemstate/gettransformlookup.md).

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](/engine/7000.0/script-reference/unity/entities/ijobentity.md), [SystemAPI.Query](/engine/7000.0/script-reference/unity/entities/systemapi/query.md) and [IJobChunk](/engine/7000.0/script-reference/unity/entities/ijobchunk.md)). 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.

[NativeContainer]: https://docs.unity3d.com/ScriptReference/Unity.Collections.LowLevel.Unsafe.NativeContainerAttribute

[NativeDisableParallelForRestrictionAttribute]: https://docs.unity3d.com/ScriptReference/Unity.Collections.NativeDisableParallelForRestrictionAttribute.html

## Properties

| Property                                                                           | Description                                                                                                                |
| ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| [this\[\]](/engine/7000.0/script-reference/unity/entities/transformlookup/item.md) | Gets the [TransformRef](/engine/7000.0/script-reference/unity/entities/transformref.md) instance for the specified entity. |

## Methods

| Method                                                                                               | Description                                                                                                                                                                                                                                                            |
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [DidChange](/engine/7000.0/script-reference/unity/entities/transformlookup/didchange.md)             | Reports whether any of [TransformRef](/engine/7000.0/script-reference/unity/entities/transformref.md) components in the chunk containing the specified [Entity](/engine/7000.0/script-reference/unity/entities/entity.md) could have changed since a previous version. |
| [EntityExists](/engine/7000.0/script-reference/unity/entities/transformlookup/entityexists.md)       | Reports whether the specified entity exists. Does not consider whether a [TransformRef](/engine/7000.0/script-reference/unity/entities/transformref.md) exists on the given entity.                                                                                    |
| [HasTransform](/engine/7000.0/script-reference/unity/entities/transformlookup/hastransform.md)       | Reports whether the specified [Entity](/engine/7000.0/script-reference/unity/entities/entity.md) instance still refers to a valid entity and that it has a transform component.                                                                                        |
| [TryGetTransform](/engine/7000.0/script-reference/unity/entities/transformlookup/trygettransform.md) | Retrieves the transform components associated with the specified [Entity](/engine/7000.0/script-reference/unity/entities/entity.md), if it exists. The return value indicates whether the component was successfully retrieved.                                        |
| [Update](/engine/7000.0/script-reference/unity/entities/transformlookup/update.md)                   | When 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.                                            |
