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

PortReference

struct 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

A reference to a port in a graph attached to a visualization context.

You can get a PortReference from a PortReference.Context using the Context.GetPortReference method, providing the unique identifier of the port. Once you have a PortReference, you can use its methods to set, retrieve, or clear the port preview for that specific port in the graph canvas. Port preview is a visualization feature that displays a label next to a port in the graph canvas. This label provides additional information about the port's value or state.

Additional resources: PortReference.Context, Context.GetPortReference

 using var context = Registry.CreateVisualizationContext(graph.ID);
 context.GetPortReference(portID).SetPreview("42.0");
 if (context.GetPortReference(portID).TryGetPreview(out var displayValue))
     Debug.Log(displayValue);
 context.GetPortReference(portID).ClearPreview();

Properties

Property Description
Context Visualization context that produced this reference.
PortID Unique identifier of the port this reference points to.

Public Methods

Method Description
ClearPreview Clears the port preview for the specified port.
Equals Indicates whether this PortReference is equal to another PortReference.
GetHashCode Returns a hash code for this PortReference.
SetPreview Sets the string value to display in a port preview for a given port.
TryGetPreview Retrieves the current string value assigned to the port preview for a given port.

Operators

Operator Description
operator != Indicates whether two PortReference values are not equal.
operator == Indicates whether two PortReference values are equal.