# parentUI

> If the GameObject that this UIDocument component is attached to has a parent GameObject, and that parent GameObject also has a UIDocument component attached to it, this value is set to the parent GameObject's UIDocument component automatically.

## Definition

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

```csharp
public UIDocument parentUI { get; }
```

### Remarks

If a UIDocument has a parent, you cannot add it directly to a panel. Unity adds it to the parent's root visual element instead.
