기술 자료

Unity Engine

Unity Engine

OnViewBuilt()

Called once, after the node's built-in UI is fully constructed and before its VisualElement is attached to the graph view.
읽는 시간 1분최근 업데이트: 2달 전

Definition

public virtual void OnViewBuilt()

Remarks

This is the recommended entry point for allocating custom UI and adding it to INodeView.Root. It fires exactly once per view instance, so any element allocated here can be safely cached in a field.
If the node is culled and later revealed, the contents of INodeView.Root are cleared; re-add your cached elements from NodeView<T>.OnCullingChanged (when
cullingEnabled
is
false
). Prefer this pattern over allocating a fresh element each time.

Examples

Label m_Label;public override void OnViewBuilt(){ m_Label = new Label($"Node: {Node.Title}"); View.Root.Add(m_Label);}