# viewDataKey

> Used for view data persistence, such as tree expanded states, scroll position, or zoom level.

## Definition

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

```csharp
[UxmlAttribute]
public string viewDataKey { get; set; }
```

### Remarks

This key is used to save and load the view data from the view data store. If you don't set this key, the persistence is disabled for the associated [VisualElement](/engine/6000.6/script-reference/unityengine/uielements/visualelement.md). For more information, refer to [View data persistence in the Unity Manual](/engine/6000.6/manual/uitoolkits/uielements/uie-support-for-editor-ui/uie-view-data.md).
