YarnSpinnerTool / YarnSpinner-Unity

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

DialogueRunner: add option to silence empty view warning #265

Closed jeffomatic closed 9 months ago

jeffomatic commented 9 months ago

When DialogueRunner.Awake() executes, it prints a warning if dialogueViews is empty.

You can toggle a boolean property called silenceDialogueViewWarning, which does what it says on the tin. When set, the warning will not be printed.

I'm writing a project where the view is set at runtime, so the warning produces unhelpful noise each time I run the project.

No, the default is to continue the old behavior.

This change is a small quality-of-life improvement, and hopefully unobtrusive for folks who don't need it!

jeffomatic commented 9 months ago

One alternative to this would be to move the warning to StartDialogue, which might be a more appropriate time to show a warning.

jeffomatic commented 9 months ago

I realize that the purpose of the warning is to ensure that the requestInterrupt gets installed properly onto a DialogueView. It's not necessary for my use-case, but doing this properly would require an API change that is way out of scope of this PR. I'll close for now.

In the meantime, if you're in my situation and are looking for a workaround, you can create a no-op instance of DialogueViewBase and hook it up to DialogueRunner, and it will suppress the warning.