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

Node.IOptionDefinitionContext.AddOption

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.IOptionBuilder AddOption(string name, Type dataType);

Parameters

Parameter Description
name The unique identifier of the option.
dataType The data type of the option.

Returns

IOptionBuilder An IOptionBuilder to further configure the option.

Description

Adds a new node option.

name is used to identify the option. It must be unique among ports and options on the node. This name is used as the ID when calling GetNodeOptionByName. If IOptionBuilder.WithDisplayName is not used, this name is also used as the option's display label.

 protected override void OnDefineOptions(IOptionDefinitionContext context)
 {
     context.AddOption("MyOption", typeof(int)))
         .WithDefaultValue(2)
         .Delayed()
 }

Declaration

public IOptionBuilder<TData> AddOption(string name);

Parameters

Parameter Description
name The unique identifier of the option.

Returns

IOptionBuilder<TData> An IOptionBuilder to further configure the option.

Description

Adds a new node option.

name is used to identify the option. It must be unique among ports and options on the node. This name is used as the ID when calling GetNodeOptionByName. If IOptionBuilder_1.WithDisplayName is not used, this name is also used as the option's display label.

 protected override void OnDefineOptions(IOptionDefinitionContext context)
 {
     context.AddOption&lt;int&gt;("MyOption")
         .WithDefaultValue(2)
         .Delayed()
 }