# RegisterReferenceUnloadedCallback(Action<VisualElement>)

> 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.7/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

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

### Parameters

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