# TryGetReference

> Retrieves the VisualElement associated with the specified authoring ID path.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.7/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

## TryGetReference\<T>(AuthoringIdPath, T)

Retrieves the [VisualElement](/engine/6000.7/script-reference/unityengine/uielements/visualelement.md) associated with the specified authoring ID path.

```csharp
public bool TryGetReference<T>(AuthoringIdPath idPath, out T element) where T : VisualElement
```

### Parameters

**** (\[AuthoringIdPath]\(/engine/6000.7/script-reference/unityengine/uielements/authoringidpath)): The authoring ID path to search for.**** (T): The element found at the given path. It's `null` if the element is no longer part of the hierarchy and has been destroyed.

### Returns

| Type                                                          | Description                                      |
| ------------------------------------------------------------- | ------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the path was found; otherwise `false`. |

## TryGetReference\<T>(DocumentNode, AuthoringIdPath, T)

Retrieves the [VisualElement](/engine/6000.7/script-reference/unityengine/uielements/visualelement.md) associated with the specified authoring Id path.

```csharp
public bool TryGetReference<T>(VisualElementAssetReferenceTable.DocumentNode documentNode, AuthoringIdPath idPath, out T element) where T : VisualElement
```

### Parameters

**** (\[DocumentNode]\(/engine/6000.7/script-reference/unityengine/uielements/visualelementassetreferencetable/documentnode)): The document node to search within. This allows searching for a path that is not based on the root.**** (\[AuthoringIdPath]\(/engine/6000.7/script-reference/unityengine/uielements/authoringidpath)): The authoring ID path to search for.**** (T): The element found at the given path. It's `null` if the element is no longer part of the hierarchy and has been destroyed.

### Returns

| Type                                                          | Description                                      |
| ------------------------------------------------------------- | ------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the path was found; otherwise `false`. |
