Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

INodeView

interface in Unity.GraphToolkit.Editor

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

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); } }

Properties

Property Description
Root The root VisualElement of the node, to which custom UI can be added.