Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


AddInputPort

Adds a new input port.
Read time 2 minutesLast updated 6 days ago

Definition

AddInputPort(string)

Adds a new input port.
IInputPortBuilder AddInputPort(string portName)

Parameters

portName

The unique identifier of the input port.

Returns

Type

Description

IInputPortBuilderAn IInputPortBuilder to further configure the input port.

Remarks

portName
is used to identify the port. It must be unique among input ports and node options on the node. This name is used as the ID when calling Node.GetInputPortByName. 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.AddInputPort("myInput") .WithDisplayName("My Input Port") .WithDataType<int>() .WithConnectorUI(PortConnectorUI.Circle) .Build();

AddInputPort<T>(string)

Adds a new typed input port with the specified name.
IInputPortBuilder<T> AddInputPort<T>(string portName)

Parameters

portName

The unique identifier of the input port.

Returns

Type

Description

IInputPortBuilder<T>An IInputPortBuilder<TData> to further configure the typed input port.

Remarks

portName
is used to identify the port. It must be unique among input ports on the node. This name is used as the ID when calling Node.GetInputPortByName. 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.AddInputPort<string>("stringInput") .WithDisplayName("String Input") .WithDefaultValue("default text") .Build();