Interface INodeOption
Interface for a node option.
Namespace: Unity.GraphToolkit.Editor
Assembly: Unity.GraphToolkit.Common.Editor.dll
Syntax
public interface INodeOption
Remarks
Node options are typed properties that appear under the node header and in the inspector when a node is selected.
Unlike ports, they cannot receive values from wires. They allow the tool developers to change the behavior or topology of the node at edit time.
For example, you can use node options to change the number of available ports on a node.
Each option has a unique name (which must be unique per node for identification), a displayName (for the UI),
and a dataType that defines the type of its value. Use TryGetValue<T>(out T) to retrieve the option's value.
Properties
dataType
The data type of the node option.
Declaration
Type dataType { get; }
Property Value
Type | Description |
---|---|
Type |
displayName
The display name of the node option shown in the UI.
Declaration
string displayName { get; }
Property Value
Type | Description |
---|---|
string |
name
The unique identifier of the node option.
Declaration
string name { get; }
Property Value
Type | Description |
---|---|
string |
Methods
TryGetValue<T>(out T)
Tries to retrieve the value of the node option using the specified type.
Declaration
bool TryGetValue<T>(out T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The variable to assign the value to, if retrieval succeeds. |
Returns
Type | Description |
---|---|
bool |
|
Type Parameters
Name | Description |
---|---|
T | The expected type of the value. |
Remarks
If the value was never explicitly set, this method still returns true
, and value
will contain the default
value for type T
.