Struct CanvasPort
One connection point on a CanvasNode.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public readonly struct CanvasPort : IEquatable<CanvasPort>
Remarks
A port is data, not a visual element: the node builds and recycles the row that draws it. The dot's colour is left unset by default so the stylesheet decides it; a caller sets color only when the colour carries meaning, such as a data type in a shader graph.
Constructors
CanvasPort(string, string, Optional<Color>, string)
Constructs a port.
Declaration
public CanvasPort(string id, string name = null, Optional<Color> color = default, string description = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The port's stable identity. |
| string | name | The label shown beside the dot. |
| Optional<Color> | color | The dot's colour, or unset to let the stylesheet decide. |
| string | description | The row's hover tooltip, or null for none. |
Properties
color
The dot's colour. Unset, the dot takes its colour from the stylesheet.
Declaration
public Optional<Color> color { get; }
Property Value
| Type | Description |
|---|---|
| Optional<Color> |
description
Shown as the port row's tooltip when it is hovered, such as the type the port carries. Null or empty shows no tooltip.
Declaration
public string description { get; }
Property Value
| Type | Description |
|---|---|
| string |
id
The port's stable identity, used by the caller to match a connection to a port.
Declaration
public string id { get; }
Property Value
| Type | Description |
|---|---|
| string |
name
The label shown beside the dot. Null or empty draws the dot alone.
Declaration
public string name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
Equals(object)
Determines whether this port equals another object.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare against. |
Returns
| Type | Description |
|---|---|
| bool | Whether the object is an equal port. |
Overrides
Equals(CanvasPort)
Determines whether two ports are equal.
Declaration
public bool Equals(CanvasPort other)
Parameters
| Type | Name | Description |
|---|---|---|
| CanvasPort | other | The other port. |
Returns
| Type | Description |
|---|---|
| bool | Whether the two ports are equal. |
GetHashCode()
A hash code for this port.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | The hash code. |