The generated view for a Node, exposed to NodeView<T0> implementations so they can add custom UI to the node.
Allocate custom UI in NodeView<T0>.OnViewBuilt and add it to INodeView.Root. The
contents of INodeView.Root are cleared whenever the node returns from being culled, so cache
your custom elements in fields and re-add them from NodeView<T0>.OnCullingChanged
(when cullingEnabled is false).
class MyNodeView : NodeView<MyNode>
{
Label m_Label;
public override void OnViewBuilt()
{
m_Label = new Label($"Node: {Node.Title}");
View.Root.Add(m_Label);
}
public override void OnCullingChanged(bool cullingEnabled)
{
if (!cullingEnabled && m_Label != null)
View.Root.Add(m_Label);
}
}
| Property | Description |
|---|---|
| Root | The root VisualElement of the node, to which custom UI can be added. |