Version: Unity 6.6 Alpha (6000.6)
LanguageEnglish
  • C#

Context

class in Unity.GraphToolkit.Editor.GraphVisualization

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

Provides access to visualization data and features for a graph.

Create a Context through Registry.CreateVisualizationContext. The context remains valid until you call Context.Dispose. While the context is alive, you can apply visualization changes (such as fill amounts and animations) to nodes in the associated graph. Each context has a unique Context.VisualizationContextId assigned at creation, which lets you distinguish ownership when multiple consumers operate on the same graph. Disposing the context unregisters it from the Registry and clears any visualization data added through it.

Additional resources: Registry, NodeReference, GraphMotion

 // Create a visualization context for a graph, then drive a node's visual state.
 Context context = Registry.CreateVisualizationContext(graphGuid);
 NodeReference nodeRef = context.GetNodeReference(nodeID);
 nodeRef.FillAmount = 50f;

// Clean up when no longer needed. context.Dispose();

Properties

Property Description
IsGraphLoaded Indicates whether the graph identified by the associated Graph.Guid is currently loaded.
IsValid Indicates whether this context can still be used. The value becomes false after Context.Dispose is called.
Motion The animation system used to drive progress animations on nodes in this visualization context.
NodeCustomizationEnabled Whether node customizations are displayed in the graph canvas.
PortPreviewEnabled Whether the port preview feature is enabled for this visualization context. Enabled by default.
VisualizationContextId The unique identifier for this context.

Public Methods

Method Description
ClearAllVisualization Clears all visualization data associated with this context.
Dispose Releases this context and clears all associated visualization data.
GetNodeReference Returns a NodeReference that identifies the node with the given ID within this visualization context.
GetPortReference Retrieves a reference to a port in the graph associated with this context, using the port's unique identifier.