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

NodeView<T0>.OnCullingChanged

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

Declaration

public void OnCullingChanged(bool cullingEnabled);

Parameters

Parameter Description
cullingEnabled true when the node has just been culled; false when the node has just returned from being culled.

Description

Called when the node's culling state changes.

Nodes are culled when they are off-screen or too small to render at the current zoom level. When the node returns from being culled (cullingEnabled is false), the contents of INodeView.Root have been cleared and the built-in parts have been rebuilt. Re-add any custom UI you allocated in NodeView<T0>.OnViewBuilt.

Cache references to your custom elements in fields so this callback can re-parent them via View.Root.Add(...) without allocating new ones.

When the node is being culled (cullingEnabled is true), you typically don't need to do anything; use this branch only if you need to release resources for culled nodes.

 Label m_Label; // Allocated in OnViewBuilt.

public override void OnCullingChanged(bool cullingEnabled) { if (!cullingEnabled && m_Label != null) { // Root was cleared while culled — re-parent the cached label. View.Root.Add(m_Label); } }