ドキュメント

Unity Engine

Unity Engine

parentUI

If the GameObject that this PanelRenderer component is attached to has a parent GameObject, and that parent GameObject also has a PanelRenderer component attached to it, this value is set to the parent GameObject's PanelRenderer component automatically.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

public PanelRenderer parentUI { get; }

Remarks

If a PanelRenderer has a parent, you cannot add it directly to a panel (PanelSettings). Unity adds it to the parent's root visual element instead.
The advantage of placing PanelRenderer GameObjects under other PanelRenderer GameObjects is that you can have many PanelRenderers all drawing in the same panel (rootVisualElement) and therefore able to batch together. A typical example is rendering health bars on top of characters, which would be more expensive to render in their separate panels (and batches) compared to combining them to a single panel, one batch.