Yarn Spinner Utility
Provides flexible utilities for Yarn Spinner dialogue systems, offering a loosely-coupled alternative to the default Unity integration. Features include a modular dialogue parser with Scriptable Object observers, customizable view controllers for lines and options, extensible command handling, and cross-scene dialogue support through the observer pattern.
Unity Project
Built with Unity 6000.0.23f1 ยท download the source from GitHub

Dependencies (39)
README
Yarn Spinner
Utilities for Yarn Spinner. The motivation for creating this is to be a replacement for the default dialogue output that comes with the Unity integration, which is, arguably, too opinionated and tightly coupled.
โ Installation
With UPM
from the Add package from git URL option, enter:
https://github.com/mushakushi/yarn-spinner-utility.git?path=Assets/YarnSpinnerUtility
If you are specifying a version, append #{VERSION} to the end of the git URL.
https://github.com/mushakushi/yarn-spinner-utility.git?path=Assets/YarnSpinnerUtility#{VERSION}
Git Dependencies
๐ Usage
Dialogue Parser
A modified version of Yarn's Minimal Dialogue Runner that allows further separation of concerns
using the Scriptable Object observer pattern and makes no assumptions about how the game will be run.
Because of this, it can work across scenes using a DialogueObserver.
View Controllers
For the recommended setup for displaying dialogue lines and options, see the OptionViewController and
LineViewController classes, respectively.
Views
Modify its views in the inspector, which is recalculated on each dialogue line and removed when the dialogue is completed.
You can create a new view by marking
any class that inherits from IView with the [System.Serializable] attribute.
[System.Serializable] public class View: IView
Command Handling
You can handle commands as you'd usually do by using YarnCommandDispatcher.AddCommandHandler.
The dialogue is must be continued manually after the command is handled.
public class ExampleCommandHandler: MonoBehaviour
{
[SerializeField] private YarnCommandDispatcher commandDispatcher;
private void Start()
{
// Please note that the "wait" command is the only command
// that is handled for you.
commandDispatcher.AddCommandHandler<float>("wait", HandleWaitCommand);
}
private void HandleWaitCommand(float waitDuration)
{
// handle the command ...
// the continue the dialogue (note: this can be done asynchronously)
commandDispatcher.dialogueParser.TryContinue();
}
}
Comments
No comments yet. Be the first!
Sign in to join the conversation
Sign In