INodeView
The generated view for a Node, exposed to NodeView<T> implementations so they can add custom UI to the node.
Read time 1 minuteLast updated 7 days ago
Definition
- Type: Interface
- Namespace: Unity.GraphToolkit.Editor
- Assembly: UnityEditor
public interface INodeView
Remarks
Allocate custom UI in NodeView<T>.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<T>.OnCullingChanged (when is false).
cullingEnabledAdditional Resources: NodeView<T>, NodeView<T>.OnViewBuilt
Examples
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); }}
Properties
Property | Description |
|---|---|
| Root | The root VisualElement of the node, to which custom UI can be added. |