Speech Bubbles

This Unity package provides two prefabs: Formal Bubble and Casual Bubble. The package requires Yarn Spinner for Unity.
This add-on is not part of the open source Yarn Spinner package, and can be purchased from the Yarn Spinner Itch.io Store or via the Unity Asset Store.
itch.io Unity Asset StoreSpeech Bubbles for Yarn Spinner provides a Casual Bubble and a Formal Bubble prefab. Both are customisable:
- customise fonts, colours, and styles of bubbles
- optional character nameplate
- flexible anchor point for bubble stem
- optionally lock bubbles to the camera
- works for 2D or 3D games
Speech Bubble Architecture
The design of the Speech Bubbles are slightly different to how most custom dialogue presenters, or even the default presenters, work.
Bubble Dialogue View
The Bubble Dialogue View is the presenter subclass and is what talks to the Dialogue Runner for the relevant events in the story. The Bubble Dialogue View manages all the bubbles that will need to be shown on screen, in particular it controls when to create and destroy them and gives them the content they need to show. The Bubble Dialogue View is a middle-man between the game objects shown on screen and Yarn Spinner.
Bubbles and Bubble Content
The Bubble and Bubble Content are the two classes that control where and what is shown on the screen. The Bubble manages positioning information, determining where to best place the canvas rectangle. What a Bubble appears like, so its shape, text, colours, and so on are determined by its Bubble Content.
The Bubble Content represents a single piece of content. So each line that needs to be shown is a piece of content, the collection of options is another piece of content. The Bubble then shows this piece of content, and when a new piece of content comes in removes the old and shows the new. The Bubble gets given this Bubble Content to show by its Bubble Dialogue View. The specific information contained within a Bubble Content changes depending on what needs to be shown to the player, the most common information is the line.
The reason for this split is because the way a bubble determines where to place itself is not significantly impacted by its content. Only the size of the text inside the content changes this, the rest is the same no matter what. This means a great deal of code could be extracted and kept generic from the rest of the presentation. This means making visually unique bubbles is now easier by subclassing the Bubble Content, all the positioning code can be reused for every visually different bubble.
Bubble Input
The last class that operates in a different manner from the Yarn Spinner norm is the Bubble Input. When the user wants to hurry up or skip lines in Yarn Spinner this is handled by the Line Advancer, Speech Bubbles however are a bit different in this respect. Because they can only show a single option at a time they need to have a way to also support changing between which option is currently being shown by the bubble, this is what the Bubble Input does.
Hurrying up and advancing lines is still something people will want to do with Speech Bubbles. How Bubble Input handles this depends on its Control Mode:
- Basic (the default): Bubble Input hurries up lines, advances lines and selects options itself, using its Advance Content input. You don’t need a Line Advancer.
- Controlled Line Advancer: Bubble Input adds a Line Advancer to its own game object, locks it, and sets its values for you. You set the values for hurrying up, skipping, and cancelling lines on the Bubble Input.
- Independent Line Advancer: Bubble Input changes and selects options, and you add and configure a Line Advancer yourself on a different game object.