From 6997ebaef45359fa12209b84cf1be9b8e624d7bd Mon Sep 17 00:00:00 2001 From: Jon Manning Date: Tue, 6 Aug 2024 14:25:49 +1000 Subject: [PATCH] Add DialogueRunner.SetProject --- Runtime/DialogueRunner.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Runtime/DialogueRunner.cs b/Runtime/DialogueRunner.cs index 78872a8a..cddb5e6b 100644 --- a/Runtime/DialogueRunner.cs +++ b/Runtime/DialogueRunner.cs @@ -599,6 +599,27 @@ async YarnTask WaitForOptionsView(AsyncDialogueViewBase? view) { } } + /// + /// Sets the dialogue runner's Yarn Project. + /// + /// + /// If the dialogue runner is currently running (that is, is ), an is thrown. + /// + /// The new to be + /// used. + /// Thrown when attempting + /// to set a new project while a dialogue is currently + /// running. + public void SetProject(YarnProject project) { + if (this.IsDialogueRunning) { + // Can't change project if we're already running. + throw new InvalidOperationException("Can't set project, because dialogue is currently running."); + } + this.yarnProject = project; + } + public void StartDialogue(string nodeName) { if (yarnProject == null) {