NodeReference
Identifies a node inside a visualization NodeReference.Context so visualization changes can be applied to it.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Struct
- Namespace: Unity.GraphToolkit.Editor.GraphVisualization
- Assembly: UnityEditor
- Implements: IEquatable<NodeReference>
public readonly struct NodeReference : IEquatable<NodeReference>
Remarks
Obtain a NodeReference from Context.GetNodeReference. The reference is only meaningful for the NodeReference.Context that produced it. You can use its properties to set, retrieve, or clear customization for that specific node in the graph canvas. Two NodeReference values are equal when they share the same NodeReference.NodeID and refer to the same NodeReference.Context instance.
Additional Resources: NodeReference.Context, Context.GetNodeReference
Examples
// Obtain a reference to a node by its GUID, then drive its visual state.using Context context = Registry.CreateVisualizationContext(graphGuid);NodeReference nodeRef = context.GetNodeReference(nodeID);// Show a half-filled accent bar on the node.nodeRef.FillAmount = 50f;// Replace the static fill with a looping progress animation.context.Motion.Play(nodeRef, animationSpeed: 1f);// Stop the animation. The bar remains visible at the previously set fill amount.context.Motion.Stop(nodeRef);
Properties
Property | Description |
|---|---|
| Context | Visualization context that produced the current node reference. |
| FillAmount | The progress fill amount displayed on the referenced node's accent bar, expressed as a percentage. |
| NodeID | Unique identifier of the node this reference points to. |
Methods
Method | Description |
|---|---|
| ClearCustomization | Clears all customization previously applied to the referenced node, removes any fill amount, and stops any looping animation. |
| Equals | Indicates whether the current NodeReference is equal to another object. |
| GetHashCode | Returns a hash code for the current NodeReference. |
Operators
Operator | Description |
|---|---|
| operator == | Compares two NodeReference values for equality. |
| operator != | Compares two NodeReference values for inequality. |