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 to graph elements (retrieved as references) 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, GraphMotion

Create a visualization context for a graph, retrieve a port reference from it, and set a port preview value. The using statement ensures the context is disposed when no longer needed.

 using Context context = Registry.CreateVisualizationContext(graphID);
 PortReference port = context.GetPortReference(portUID);
 port.SetPreview("42.0");

Properties

Property Description
IsGraphLoaded Indicates whether the graph identified by the associated Graph.ID 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 animations on graph elements in this visualization context.
NodeCustomizationEnabled Whether the node customization feature is enabled for this visualization context. Enabled by default.
PortPreviewEnabled Whether the port preview feature is enabled for this visualization context. Enabled by default.
VisualizationContextID The unique identifier for this context.
WireCustomizationEnabled Whether the wire customization feature is enabled for this visualization context. Enabled by default.

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.
GetWireReference Returns a WireReference that identifies the node with the given ID within this visualization context.