YarnSpinner-Unity
YarnSpinner-Unity copied to clipboard
Stopping dialog runner does not stop running coroutine commands
What is the current behavior?
Calling DialogRunner.Stop() while a coroutine command is running does not stop the command. When the command finishes, ContinueDialog() will be called and the dialog restarted.
Please provide the steps to reproduce, and if possible a minimal demo of the problem:
Create and run a dialog that contains a <<wait x>> command and call DialogRunner.Stop() during the wait. Note that once the wait command coroutine completes, RunLine will be called on the dialog views.
What is the expected behavior? The dialog is stopped and no further methods are called on the dialog views.
Please tell us about your environment:
- Yarn Spinner Version: 2.2.1
- Unity Version: 2021.3.6
Other information
As a workaround, I've added a call to StopAllCoroutines() in the DialogRunner.Stop() method. Since currently only command coroutines are running on the dialog runner, this works ok but maybe specifically tracking and stopping only the command coroutines would be better.
Wanted to let you know that I am experiencing this same issue.
Just as an aside this doesn't technically stop a running coroutine, it just prevents it from restarting the dialogue.
We could have aborted the coroutine but because other than <<wait>> we don't know what they do we felt it better to just let the coroutine finish.
For the most part this has essentially the same end result.