Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


AddOutputPort

Adds a new output port with the specified name.
Read time 2 minutesLast updated 6 days ago

Definition

AddOutputPort(string)

Adds a new output port with the specified name.
IOutputPortBuilder AddOutputPort(string portName)

Parameters

portName

The unique identifier of the output port.

Returns

Type

Description

IOutputPortBuilderAn IOutputPortBuilder to further configure the output port.

Remarks

portName
is used to identify the port. It must be unique among output ports on the node. This name is used as the ID when calling Node.GetOutputPortByName. If IPortBuilder<T>.WithDisplayName is not used, this name is also used as the port's display label.
Warning: Changing a port's name breaks any existing connections, because the name is used as the port's unique ID.
Use the returned builder to configure port properties and then call IPortBuilder<T>.Build() to create the port.

Examples

var port = context.AddOutputPort("myOutput") .WithDisplayName("My Output Port") .WithDataType(typeof(float)) .WithConnectorUI(PortConnectorUI.Arrowhead) .Build();

AddOutputPort<T>(string)

Adds a new typed output port with the specified name.
IOutputPortBuilder<T> AddOutputPort<T>(string portName)

Parameters

portName

The unique identifier of the output port.

Returns

Type

Description

IOutputPortBuilder<T>An IOutputPortBuilder<TData> to further configure the typed output port.

Remarks

portName
is used to identify the port. It must be unique among output ports on the node. This name is used as the ID when calling Node.GetOutputPortByName. If IPortBuilder<T>.WithDisplayName is not used, this name is also used as the port's display label.
Warning: Changing a port's name breaks any existing connections, because the name is used as the port's unique ID.
Use the returned builder to configure port properties and then call IPortBuilder<T>.Build() to create the port.

Examples

var port = context.AddOutputPort<bool>("boolOutput") .WithDisplayName("Boolean Output") .Build();