# RegisterReferenceUnloadedCallback(Action<T>)

> Registers a callback for when the referenced object is unloaded. This occurs when the document is destroyed, such as when a live reload occurs after the VisualTreeAsset changes. At this point, all references are invalid and should be cleared.

## Definition

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

```csharp
public void RegisterReferenceUnloadedCallback(Action<T> callback)
```

### Parameters

**** (\[Action\<T>]\(https\://learn.microsoft.com/dotnet/api/system.action-1)): The callback to invoke when the reference is unloaded.
