Version: Unity 6.4 Alpha (6000.4)
LanguageEnglish
  • C#

Node.IPortDefinitionContext.AddInputPort

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

Declaration

public Unity.GraphToolkit.Editor.IInputPortBuilder AddInputPort(string portName);

Parameters

Parameter Description
portName The unique identifier of the input port.

Returns

IInputPortBuilder An IInputPortBuilder to further configure the input port.

Description

Adds a new input port.

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 GetInputPortByName. If IPortBuilder_1.WithDisplayName is not used, this name is also used as the port's display label. Warning: Changing a port's name will break any existing connections, as the name is used as the port's unique ID. Use the returned builder to configure port properties and then call IPortBuilder_1.Build to create the port.

 var port = context.AddInputPort("myInput")
     .WithDisplayName("My Input Port")
     .WithDataType&lt;int&gt;()
     .WithConnectorUI(PortConnectorUI.Circle)
     .Build();

Declaration

public IInputPortBuilder<T> AddInputPort(string portName);

Parameters

Parameter Description
portName The unique identifier of the input port.

Returns

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

Description

Adds a new typed input port with the specified name.

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 GetInputPortByName. If IPortBuilder_1.WithDisplayName is not used, this name is also used as the port's display label. Warning: Changing a port's name will break any existing connections, as the name is used as the port's unique ID. Use the returned builder to configure port properties and then call IPortBuilder_1.Build to create the port.

 var port = context.AddInputPort&lt;string&gt;("stringInput")
     .WithDisplayName("String Input")
     .WithDefaultValue("default text")
     .Build();