// we call AddFunction in Awake instead of Start, to ensure the Yarn function "visited()" // is added to the Dialogue Runner before it starts automatically (if configured to start automatically) void Awake() { // Register a function on startup called "visited" that lets // Yarn scripts query to see if a node has been run before. dialogueRunner.AddFunction("visited", delegate(string nodeName) { return(_visitedNodes.Contains(nodeName)); }); }
void Start() { // Register a function on startup called "visited" that lets Yarn // scripts query to see if a node has been run before. dialogueRunner.AddFunction( "visited", 1, delegate(Yarn.Value[] parameters) { var nodeName = parameters[0]; return(_visitedNodes.Contains(nodeName.AsString)); }); }