# TryGetTransform

> Retrieves the transform components associated with the specified Entity, if it exists. The return value indicates whether the component was successfully retrieved.

## Definition

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

## TryGetTransform(Entity, TransformRef)

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.

```csharp
public bool TryGetTransform(Entity entity, out TransformRef transform)
```

### Parameters

**** (\[Entity]\(/engine/7000.0/script-reference/unity/entities/entity)): The entity.**** (\[TransformRef]\(/engine/7000.0/script-reference/unity/entities/transformref)): The transform component of type T for the given entity, if it exists.

### Returns

| Type                                                          | Description                                                                                                                                                                                                                                            |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the entity has a [TransformRef](/engine/7000.0/script-reference/unity/entities/transformref.md) component, and false if it does not. Also returns false if the Entity instance refers to an entity that has been destroyed (or never existed). |

## TryGetTransform(Entity, TransformRef, bool)

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.

```csharp
public bool TryGetTransform(Entity entity, out TransformRef transform, out bool entityExists)
```

### Parameters

**** (\[Entity]\(/engine/7000.0/script-reference/unity/entities/entity)): The entity.**** (\[TransformRef]\(/engine/7000.0/script-reference/unity/entities/transformref)): The transform component of type T for the given entity, if it exists.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Denotes whether the given entity exists. Use to distinguish entity non-existence from TransformRef non-existence.

### Returns

| Type                                                          | Description                                                                                                                                                                                                                                            |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the entity has a [TransformRef](/engine/7000.0/script-reference/unity/entities/transformref.md) component, and false if it does not. Also returns false if the Entity instance refers to an entity that has been destroyed (or never existed). |
