Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


IVariable

Interface for a graph variable.
Read time 1 minuteLast updated 6 days ago

Definition

public interface IVariable

Remarks

Variables are data containers that are accessible throughout a graph. You can manage variables in the Blackboard and reference them with variable nodes. A variable has a name, a data type, a kind that defines its visibility within subgraphs, and an optional default value. Use IVariable.TryGetDefaultValue to retrieve the default value if one exists. Variables are distinct from variable nodes. However, you can drag variables onto the graph canvas, where they are instantiated as variable nodes.

Properties

Property

Description

DataTypeGets or sets the data type of the variable.
GraphThe IVariable.Graph that owns this variable.
IDThe globally unique identifier for this variable declaration.
IsConnectedWhether the variable has at least one connected variable node in the graph.
NameGets or sets the name of the variable.
NodeCountThe number of variable nodes associated with this variable in the graph.
VariableKindGets or sets the kind of the variable, such as Local, Input, or Output.

Methods

Method

Description

GetNodesRetrieves all variable nodes associated with this variable.
RemoveFromGraphRemoves the current variable from its graph.
TryGetDefaultValueRetrieves the default value of the variable.
TrySetDefaultValueSets the default value of the variable.