# VisualElementAssetReferenceTable

> A reference table to map authoring id paths to VisualElements.

## Definition

* **Type:** Class
* **Namespace:** [UnityEngine.UIElements](/engine/6000.6/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule
* **Implements:** [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

```csharp
public sealed class VisualElementAssetReferenceTable : IDisposable
```

## Remarks

This example shows how to use the `VisualElementAssetReferenceTable` to resolve references to VisualElements after calling CloneTree.

## Examples

```csharp
using UnityEngine;
using UnityEngine.UIElements;

public class VisualElementAssetReferenceTable_CloneTreeExample : MonoBehaviour
{
    // Set via the Inspector
    public VisualTreeAsset treeAsset;

    void Start()
    {
        var target = new VisualElement();
        treeAsset.CloneTree(target, out var referenceTable);

        // Example of retrieving a referenced element by its Authoring Id
        if (referenceTable.TryGetReference<Button>(new AuthoringIdPath(42), out var myButton))
        {
            Debug.Log("Found button!");
        }

        // Example of retrieving a the root element
        if (referenceTable.TryGetReference<VisualElement>(new AuthoringIdPath(0), out var root))
        {
            Debug.Log("Found root!");
        }

        // Example of retrieving a nested element inside of multiple template instances
        if (referenceTable.TryGetReference<VisualElement>(new AuthoringIdPath(1, 5, -19, 11, 1), out var nestedElement))
        {
            Debug.Log("Found nested element!");
        }

        // Release the reference table back to the pool when done
        referenceTable.ReleaseToPool();
    }
}
```

## Properties

| Property                                                                                                | Description                                                                                 |
| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| [root](/engine/6000.6/script-reference/unityengine/uielements/visualelementassetreferencetable/root.md) | The root represents the root element of the PanelRenderer and may not have an authoring ID. |

## Methods

| Method                                                                                                                        | Description                                                                                                                                                                                                                                                  |
| ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Dispose](/engine/6000.6/script-reference/unityengine/uielements/visualelementassetreferencetable/dispose.md)                 | Disposes the VisualElementAssetReferenceTable. Releases all cached references and disposes all nodes.                                                                                                                                                        |
| [ReleaseToPool](/engine/6000.6/script-reference/unityengine/uielements/visualelementassetreferencetable/releasetopool.md)     | Releases the [VisualElementAssetReferenceTable](/engine/6000.6/script-reference/unityengine/uielements/visualelementassetreferencetable.md) and all its associated nodes back to the pool, making them available for reuse and reducing allocation overhead. |
| [TryGetReference](/engine/6000.6/script-reference/unityengine/uielements/visualelementassetreferencetable/trygetreference.md) | Retrieves the [VisualElement](/engine/6000.6/script-reference/unityengine/uielements/visualelement.md) associated with the specified authoring ID path.                                                                                                      |

## Classes

| Class                                                                                                                                                    | Description                                                                                                          |
| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| [VisualElementAssetReferenceTable.DocumentNode](/engine/6000.6/script-reference/unityengine/uielements/visualelementassetreferencetable/documentnode.md) | Holds a reference to either the root element of a PanelRenderer or a template instance. This node can have children. |
| [VisualElementAssetReferenceTable.ElementNode](/engine/6000.6/script-reference/unityengine/uielements/visualelementassetreferencetable/elementnode.md)   | Holds a reference to a [VisualElement](/engine/6000.6/script-reference/unityengine/uielements/visualelement.md).     |
