YarnSpinnerTool / YarnSpinner-Unity

The official Unity integration for Yarn Spinner, the friendly dialogue tool.
MIT License
491 stars 85 forks source link

Don't `DismissLine` when options are presented #266

Open jakezatecky opened 7 months ago

jakezatecky commented 7 months ago

Is your feature request related to a problem? Please describe. Instead of persisting the last line of dialogue alongside the dialogue options, Yarn Spinner will invoke DismissLine. It has the concept of LastLine for the OptionsListView, but that does not persist the same formatting of the previous dialogue line.

For context, I have a dialogue system that presents dialogue options to the right of the current dialogue line. I do this to show the full context for the options the player has. I do not use LastLine, because it collapses relevant information into a singular text element.

Therefore, I use a modified LineView that does not dismiss itself when DialogueRunner calls DismissLine. I manage the transition to new lines with the RunLine method, instead. I attach an onDialogueComplete event to remove the last line when the dialogue concludes.

While this works, it is an unpleasant workaround to the fact that Yarn Spinner dismisses lines before options appear.

Describe the solution you'd like Rather than invoking DismissLine when Yarn encounters a set of options, I would like to have an option to force it to wait until it is ready to read a new line. This way, instead of using the awkward LastLine component, we can persist the previous piece of dialogue, with the full context for the player.

Describe alternatives you've considered As noted above, I use a modified variant of LineView and rely on onDialogueComplete to clean up the last line when the dialogue concludes.

Additional context The way I manage dialogue is more commonplace in video games than the model Yarn Runner uses. Most games persist whatever piece of dialogue triggered a set of options instead of dismissing it and rendering a condensed variant.