Clear all variables. By default node visit counts will not be cleared.
To remove node visit counts as well, set clearNodeVisits to
Note that node visit variable names are prefixed with an @ symbol.
If you have custom variables that start with an @ symbol these will
also be retained if clearNodeVisits is
false. These will need to be
removed individually using
Remove a variable by name.
Accessing variable storage¶
Variable storage is accessed via the YarnProject.
final variables = yarnProject.variables;
In most cases variables should be retained for the life of the YarnProject. However there may be situations where variables need to be removed from storage. For example, in a game with many scenes, variables specific to that scene could be removed if they are no longer required.
Remove all variables with
clear. By default this will retain node visit counts, which are also
stored as variables. Node visit counts are used by Yarn for logic such as ‘do this if the node has
already been visited’, so it’s best to leave these alone. However, to remove them as well set
/// Clear all variables except node visit counts.
/// Clear all variables including node visit counts.
remove to remove a single variable.