Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DialogueException: Cannot continue running dialogue. No node has been selected. #262

Closed
Bryan-Legend opened this issue Jan 8, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@Bryan-Legend
Copy link

Bryan-Legend commented Jan 8, 2024

Often after Runner.Dialogue.Stop(); is called I am seeing the following exception.

Could you please not throw an exception when dialog is stopped and using the standard LineView?

image

@Bryan-Legend Bryan-Legend added the bug Something isn't working label Jan 8, 2024
@Bryan-Legend
Copy link
Author

This is using the latest 2.4.0 release.

DialogueException: Cannot continue running dialogue. No node has been selected.
Yarn.VirtualMachine.CheckCanContinue () (at <015661c7468d41c3b0a915d84199b7f6>:0)
Yarn.VirtualMachine.Continue () (at <015661c7468d41c3b0a915d84199b7f6>:0)
Yarn.Dialogue.Continue () (at <015661c7468d41c3b0a915d84199b7f6>:0)
Yarn.Unity.DialogueRunner.ContinueDialogue (System.Boolean dontRestart) (at ./Library/PackageCache/dev.yarnspinner.unity@2.4.0/Runtime/DialogueRunner.cs:1142)
Yarn.Unity.DialogueRunner.DialogueViewCompletedDismissal (Yarn.Unity.DialogueViewBase dialogueView) (at ./Library/PackageCache/dev.yarnspinner.unity@2.4.0/Runtime/DialogueRunner.cs:1217)
Yarn.Unity.DialogueRunner+<>c__DisplayClass111_0.b__0 () (at ./Library/PackageCache/dev.yarnspinner.unity@2.4.0/Runtime/DialogueRunner.cs:1202)
Yarn.Unity.LineView+d__22.MoveNext () (at ./Library/PackageCache/dev.yarnspinner.unity@2.4.0/Runtime/Views/LineView.cs:278)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <30adf90198bc4c4b83910c6fb1877998>:0)

@McJones
Copy link
Contributor

McJones commented Jan 10, 2024

I would recommend calling Stop() on the dialogue runner, not the dialogue itself.
While you can interface directly with the dialogue object it's not really got any safeguards on it, so what is happening is the dialogue is being stopped but then the line view isn't being told about it, and then is asking the runner to continue stopped dialogue which is throwing the exception.
The Stop method on the runner does tell views to dismiss themselves which will prevent this bug.
So use Runner.Stop(); in place of Runner.Dialogue.Stop();.

I am going to close this issue as the solution is to not call stop on the dialogue but on the runner.
If you do want to talk directly to the dialogue object it's on you to make sure that important dialogue events are passed on to the different pieces that need to be informed about them.

@McJones McJones closed this as completed Jan 10, 2024
@Bryan-Legend
Copy link
Author

Okay. I changed my code to call Runner.Stop instead, but unfortunately the bug is still happening.

The presence of LineView.DismissLineInternal high in the call stack (LineView.cs line 278) makes me think that the view dismissing itself is what is causing this issue. The code to dismiss the line view seems to be checking continue after it's already been stopped.

@Bryan-Legend
Copy link
Author

Bryan-Legend commented Jan 10, 2024

Also, here is the DialogueRunner.Stop method. It doesn't appear to be doing anything with the views.

        /// <summary>
        /// Stops the <see cref="Dialogue"/>.
        /// </summary>
        public void Stop()
        {
            IsDialogueRunning = false;
            Dialogue.Stop();
        }

@McJones
Copy link
Contributor

McJones commented Jan 10, 2024

The HandleDialogueComplete method which is a dialogue event on the runner is what tells the views to dismiss, not Stop itself, but it is called as an effect of Stop being called.

If the issue is still happening though I will reopen the issue but can you give more information as to how you are triggering this?
Because when I stop dialogue in the middle of a line I don't get this error.

@McJones McJones reopened this Jan 10, 2024
@Bryan-Legend
Copy link
Author

Yes. It's still happening. I'm wondering if HandleDialogComplete is not getting run for some reason.

I suspect that it has something to do with the Auto Advance setting on the Line View. The exception seems to happen about a half second after the dialog is skipped (via Runner.Stop) as shown in this screenshot console log time stamps. I also show my line view inspector so you can match my settings.

image

image

@Bryan-Legend
Copy link
Author

I've confirmed that HandleDialogComplete is running and calling LineView.DialogueComplete correctly.

Also I've confirmed that the exception does not happen with Auto Advance off, but then sometimes text will be left on the screen after a cancel when Auto-Advance is turned off.

@McJones
Copy link
Contributor

McJones commented Jan 12, 2024

thanks, investigating.

@Bryan-Legend
Copy link
Author

Bryan-Legend commented Jan 19, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants