diff --git a/Runtime/DialogueRunner.cs b/Runtime/DialogueRunner.cs index cddb5e6b..f7898bde 100644 --- a/Runtime/DialogueRunner.cs +++ b/Runtime/DialogueRunner.cs @@ -517,15 +517,13 @@ private async YarnTask OnOptionsReceivedAsync(OptionSet options) } var dialogueSelectionTCS = new YarnOptionCompletionSource(); - int pendingOptionViews = 0; int viewsNotReturningOption = 0; async YarnTask WaitForOptionsView(AsyncDialogueViewBase? view) { if (view == null) { return; } - pendingOptionViews += 1; - + var result = await view.RunOptionsAsync(localisedOptions, optionCancellationSource.Token); if (result != null) { // We no longer need the other views, so tell them to stop @@ -535,7 +533,7 @@ async YarnTask WaitForOptionsView(AsyncDialogueViewBase? view) { } else { // Our view did not return an option. viewsNotReturningOption += 1; - if (viewsNotReturningOption >= pendingOptionViews) { + if (viewsNotReturningOption >= this.dialogueViews.Count) { // No view returned an option, so it's unanimous. Set the result to 'null'. dialogueSelectionTCS.TrySetResult(null); }