Skip to content

Releases: YarnSpinnerTool/YarnSpinner-Unity

v3.1.1

04 Dec 00:34
199cc31

Choose a tag to compare

Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron, or by buying a copy of Yarn Spinner on itch.io or the Unity Asset Store!

👩‍🚒 Getting Help

There are several places you can go to get help with Yarn Spinner.

📦 How To Install Yarn Spinner

To install the most recent release of Yarn Spinner for Unity, please see the Installation Instructions in the Yarn Spinner documentation.

If you want to install this particular version of Yarn Spinner for Unity, follow these steps:

Installing Yarn Spinner for Unity v3.1.1 from Git

  • Open the Window menu, and choose Package Manager.
  • If you already have any previous version of the Yarn Spinner package installed, remove it.
  • Click the + button, and click Add package from git URL...
  • Enter the following URL:
    • https://github.com/YarnSpinnerTool/YarnSpinner-Unity.git#v3.1.1

Each release will have a different URL. To upgrade to future versions of Yarn Spinner, you will need to uninstall the package, and reinstall using the new URL.

📜 Changes

Overview

Yarn Spinner for Unity 3.1 contains a number of improvements and useful changes.

Dialogue Runner Is Now More Async

The dialogue runner's StartDialogue and Stop methods are now async, and return a task. When you call StartDialogue, you'll receive a task (either a System.Threading.Tasks task, a UnityEngine.Awaitable, or a UniTask) that will complete after every dialogue presenter has finished running its OnDialogueStartedAsync method. Likewise, the Stop method will finish after every dialogue presenter has finished running its OnDialogueCompleteAsync method. This is really useful for making sure that you don't accidentally make a change to your scene in the middle of your dialogue presenters getting ready.

Dialogue Option Fallthrough

In Yarn Spinner, you can add a condition to the end of an option. If the condition evaluates to false, Yarn Spinner will mark the option as "unavailable". It's up to your game to decide what that means - you might want to make the option visible but unselectable, or you might want to hide the option from the player entirely. However, if every option is unavailable, the player has no option they could select. Previously, this could cause your game to have to soft-lock the player, since they weren't able to proceed.

In Yarn Spinner 3.1, dialogue presenters are now allowed to tell the Dialogue Runner that no option was selected at all. When this happens, Yarn Spinner will skip the options and move on to the next part of the script:

Guard: Who goes there?

// If the player is a thief, a royal visitor, or a merchant, then
// go run the appropriate conversation for that. The player might be
// some combination of the three, so let them choose.
-> A thief! <<if $player_is_thief>>
    <<jump Guard_Thief_Conversation>>
-> A royal visitor! <<if $player_is_royal_visitor>>
    <<jump Guard_RoyalVisitor_Conversation>>
-> A merchant! <<if $player_is_merchant>>
    <<jump Guard_Merchant_Conversation>>

// But if the player is NONE of those, then none of the options would have
// been available. We'll fall through to here.

Player: I'm nobody!
<<jump Guard_Nobody_Conversation>>

Note

You can turn off this behaviour by setting the allowOptionFallthrough property on your DialogueRunner to false.

Lines Know Where They Came From

When Yarn Spinner sends a line to your game, it wraps up the line in an object called a LocalizedLine. Previously, if your game has multiple Dialogue Runners that are running at the same time, it wasn't possible to know which runner the line came from. In Yarn Spinner 3.1, the LocalizedLine now has a Source property that tells you where it came from.

Options Can Now Be Hurried Up And Cancelled

Just like how lines have a separate 'hurry up' and 'next' cancellation tokens that act as a signal to move things along, options now have the same 'hurry up' and 'next' tokens. (Previously, they only had a single cancellation token that signalled that option selection was no longer necessary.) This allows your game to signal that you want to hurry up the presentation of your dialogue's options.

New Typewriter System

We've updated the way that typewriters are used in the built-in Line Presenter system, to make it easier to customise. This is useful for when you want to take full control over how the line appears over time, and for when you want to have in-game events occur (like sound effects) as the line appears.

To create a custom typewriter, create a class that implements IAsyncTypewriter. You can find an example of how to write a custom typewriter in the source code for the LetterTypewriter class.

Note

As part of this change, the On Character Typed event on Line Presenter has been removed. If you want to run code every time a character appears, create a new script that subclasses from ActionMarkupHandler, and add that to an object in your scene. Add that object to the Line Presenter's "Event Handlers" list. In your ActionMarkupHandler subclass, you can write code that gets called every time characters appear on screen by implementing the OnCharacterWillAppear method.

Removed Legacy DialogueView Classes

Yarn Spinner 3.0 introduced a new programming model for presenting dialogue, called Dialogue Presenters. As part of the rollout of this new API, we made the old DialogueView class act as a compatibility layer, and marked it as deprecated. Yarn Spinner 3.1 removes this deprecated code. If you have code that started life as a Yarn Spinner 2.0 project, you will need to migrate your legacy dialogue presentation UI code to use Dialogue Presenters by changing their parent class to DialoguePresenter, and implementing the new methods for presenting lines and options

Added

  • DialogueRunner will now log warnings if a dialogue presenter throws an OperationCanceledException - these usually indicate that a task they were themselves waiting on was cancelled, and that the presenter didn't clean up.
  • The generated .ysls.json file now contains more complete command and function information.
  • Added a new attribute for Yarn Spinner editors: LabelFrom allows specifying a dynamic label for a property by invoking a method.
  • Added multiple typewriters and support for them on the LinePresenter:
    • By Word
    • By Letter
    • Instantly
  • Added a virtual IAsyncTypewriter field Typewriter onto DialoguePresenterBase
  • Added new virtual OnNodeEnter and OnNodeExit calls onto DialoguePresenterBase.
  • Added a static FindRunner call onto DialogueRunner, which first tries to find it on the game object itself, followed by anywhere in the scene.
  • Added a Source field to the LocalizedLine, this can be of any type but by default will be the DialogueRunner that caused the line to be created
  • Options can now be hurried up, the same as lines
    • added RunOptionsAsync(DialogueOption[], LineCancellationToken) to DialoguePresenterBase.
      • this method is virtual and is now the recommended way to respond to options
      • the default implementation just returns nothing selected
    • added NextContentToken to LineCancellationToken which mirrors the existing NextLineToken.
    • added IsNextContentRequested to LineCancellationToken which mirrors the existing IsNextLineRequested bool.
    • added RequestHurryUpOption to DialogueRunner.
    • added hurry up option inputs to LineAdvancer
  • LineAdvancer now better handles situations where you want to use the same input for hurrying up and skipping lines.
    • This behaviour is controllable via the separateHurryUpAndAdvanceControls field
  • Added a new container type InterfaceContainer, a wrapper class to clean up some interface serialisation pains

Changed

  • Fixed a compiler error that occurred when the Unity Input System was enabled, but not actually installed.
  • Fixed an error where calls to DialogueRunner.AddFunction() in methods that are...
Read more

v3.0.3

21 Jun 05:47

Choose a tag to compare

Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron, or by buying a copy of Yarn Spinner on itch.io or the Unity Asset Store!

👩‍🚒 Getting Help

There are several places you can go to get help with Yarn Spinner.

📦 How To Install Yarn Spinner

To install the most recent release of Yarn Spinner for Unity, please see the Installation Instructions in the Yarn Spinner documentation.

If you want to install this particular version of Yarn Spinner for Unity, follow these steps:

Installing Yarn Spinner for Unity v3.0.3 from Git

  • Open the Window menu, and choose Package Manager.
  • If you already have any previous version of the Yarn Spinner package installed, remove it.
  • Click the + button, and click Add package from git URL...
  • Enter the following URL:
    • https://github.com/YarnSpinnerTool/YarnSpinner-Unity.git#v3.0.3

Each release will have a different URL. To upgrade to future versions of Yarn Spinner, you will need to uninstall the package, and reinstall using the new URL.

📜 Changes

Added

  • Added a [br /] markup tag into the common markers default markup palette.
    • This will be translated into a TextMeshPro <br> marker.
  • Line Advancer will now fall back to using key codes if Input Actions are selected, but Unity Input System is not available.
  • The Dialogue System prefab now creates a UI input module that matches your current input system when it's added to the scene, rather than baking in a specific input module.

Changed

  • Fixed a bug where LinePresenter would not run all registered action markup handlers during a typewriter effect.
  • Fixed an issue where the default Dialogue Runner prefab didn't have its LineAdvancer component configured correctly.
  • Renamed actionMarkupHandlers to be eventHandlers on the LinePresenter, this fixes an easy to occur typo with the base classes ActionMarkupHandlers.
  • Fixed an issue where Line Advancers set to use Key Codes would not work when the Legacy Input Manager is not available.

v3.0.2

13 Jun 05:41

Choose a tag to compare

Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron, or by buying a copy of Yarn Spinner on itch.io or the Unity Asset Store!

👩‍🚒 Getting Help

There are several places you can go to get help with Yarn Spinner.

📦 How To Install Yarn Spinner

To install the most recent release of Yarn Spinner for Unity, please see the Installation Instructions in the Yarn Spinner documentation.

If you want to install this particular version of Yarn Spinner for Unity, follow these steps:

Installing Yarn Spinner for Unity v3.0.2 from Git

  • Open the Window menu, and choose Package Manager.
  • If you already have any previous version of the Yarn Spinner package installed, remove it.
  • Click the + button, and click Add package from git URL...
  • Enter the following URL:
    • https://github.com/YarnSpinnerTool/YarnSpinner-Unity.git#v3.0.2

Each release will have a different URL. To upgrade to future versions of Yarn Spinner, you will need to uninstall the package, and reinstall using the new URL.

📜 Changes

Added

  • The inspector for the Dialogue Runner now has a drop down for selecting the saliency strategy.
  • VariableStorageBehaviour now supports adding a variable change listener for all variables.

Changed

  • The Yarn Spinner header in the Inspector no longer shows <u></u> markup in versions of Unity prior to Unity 6.
  • LinePresenter now implements its typewriter effect with BasicTypewriter, an implementation of the IAsyncTypewriter interface.
  • The typewriter effect in LinePresenter is now framerate-independent.
  • Fixed an issue in UnityLocalisedLineProvider where an exception would be thrown if an asset table was not provided.

Removed

  • SerializableDictionary<TKey,TValue> no longer exposes non-generic IDictionary methods; instead, all operations are now correctly type-checked.

v3.0.0

02 Dec 04:43

Choose a tag to compare

Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron, or by buying a copy of Yarn Spinner on itch.io or the Unity Asset Store!

👩‍🚒 Getting Help

There are several places you can go to get help with Yarn Spinner.

📦 How To Install Yarn Spinner

To install the most recent release of Yarn Spinner for Unity, please see the Installation Instructions in the Yarn Spinner documentation.

If you want to install this particular version of Yarn Spinner for Unity, follow these steps:

Installing Yarn Spinner for Unity v3.0.0 from Git

  • Open the Window menu, and choose Package Manager.
  • If you already have any previous version of the Yarn Spinner package installed, remove it.
  • Click the + button, and click Add package from git URL...
  • Enter the following URL:
    • https://github.com/YarnSpinnerTool/YarnSpinner-Unity.git#v3.0.0

Each release will have a different URL. To upgrade to future versions of Yarn Spinner, you will need to uninstall the package, and reinstall using the new URL.

📜 Changes

Added

  • A basic saliency sample to show off the basics and how to get started with storylets.
  • Logo and docs/help links to custom editors in Yarn Project (standalone), Yarn Script (standalone), and Dialogue Runner (component when on GameObject).
  • Description of package samples which summarises Samples therein.
  • Updated a few out-of-date HelpUrl values which referenced v1 docs.
  • Default Yarn Project exlude patterns updated to ignore the standard samples folders
  • Functions that are registered using the AddFunction method are now supported by the Yarn Spinner compiler.
  • YarnPackageImporter now has an install samples menu item in Window -> Yarn Spinner -> Install Samples
  • 'Incorrect number of parameters' error messages when running commands will now show more detailed error messages if available.
  • Yarn scripts can now directly link to vscode for situations where you want to use that as your Yarn editor but have another editor as your C# editor.
  • UnityLocalisedLineProvider now supports fallback locales.
  • UnityLocalisedLineProvider now supports shadow lines.
  • BuiltinLocalisedLineProvider now supports falling back to different locale.
  • DialogueRunner.DialogueTask now completes after all dialogue presenters finish their OnDialogueComplete method call, rather than before.
  • The DialogueRunner.onDialogueComplete event is now invoked after all dialogue presenters finish their OnDialogueComplete method call, rather than before.

Changed

  • Fixed an error that caused the YarnProject asset editor to incorrectly report a compile error when there wasn't one.
  • Certain errors thrown when a command can't be run now show the full text of the command, not just the command name.
  • The default Yarn Spinner Script template is now no longer an empty node.
  • Renamed 'Dialogue View Script' menu item to 'Dialogue Presenter Script'.
  • Added DialogueRunner.DialoguePresenters (and marked DialogueRunner.DialogueViews as obsolete.)
  • Fixed a lot of missing null checks
  • Fixed a bug in SampleRenderDetector that caused build errors.
  • Menu for creating a prefab dialogue system now says "Dialogue System" instead of "Dialogue Runner"
  • Line Advancer will now advance to the next line if the line presenter is finished presentation and is awaiting input and the player sends the hurry up action
    • this only happens when the default line presenter is the one presenting the line
    • other presenters don't really have an obvious "I am done showing, but not done presenting" concept as the line presenter does
    • adopting this behaviour into other presenters is not difficult, just not something that can be done automatically

Removed

  • SaveStateToPlayerPrefs method
  • LoadStateFromPlayerPrefs method
  • LinesAvailable property from line providers, it no longer makes sense in an async world
  • baseLayer property on Simple Character as it was no longer used
  • Obsolete uxml elements on LanguagePopup.cs
  • All samples, they now live in their own repository

v3.0.0-beta2

09 Mar 03:46

Choose a tag to compare

v3.0.0-beta2 Pre-release
Pre-release

Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron, or by buying a copy of Yarn Spinner on itch.io or the Unity Asset Store!

👩‍🚒 Getting Help

There are several places you can go to get help with Yarn Spinner.

📦 How To Install Yarn Spinner

To install the most recent release of Yarn Spinner for Unity, please see the Installation Instructions in the Yarn Spinner documentation.

If you want to install this particular version of Yarn Spinner for Unity, follow these steps:

Installing Yarn Spinner for Unity v3.0.0-beta2 from Git

  • Open the Window menu, and choose Package Manager.
  • If you already have any previous version of the Yarn Spinner package installed, remove it.
  • Click the + button, and click Add package from git URL...
  • Enter the following URL:
    • https://github.com/YarnSpinnerTool/YarnSpinner-Unity.git#v3.0.0-beta2

Each release will have a different URL. To upgrade to future versions of Yarn Spinner, you will need to uninstall the package, and reinstall using the new URL.

📜 Changes

Added

  • Yarn action handling now supports a wider range of return values.
  • YarnImporter.GetHashString() is now public.
  • UnityLocalisedLineProvider no longer throws an exception if an asset table is provided but does not contain an asset for a line.
  • DialogueRunner.CommandDispatcher is now set up on first access, rather than in Awake.
    • This allows other objects to work with the command dispatcher (for example, registering new methods) in their Awake methods, even if their Awake methods run before DialogueRunner's.
  • YarnCommand and YarnFunction commands now allow including . characters in their names.
  • Fixed an issue in SerializableDictionary.cs that caused builds to fail.
  • DialogueRunner.AddCommandHandler and DialogueRunner.AddFunction now validate that the provided names contain no spaces.
  • DialogueRunner.AddCommandHandler now supports methods whose last parameter is an array of values.
    • This allows for commands with a variable list of parameters. For example, consider the following method:
      void LogStrings(int a, string[] remainder) {
        Debug.Log($"a = {a}, remainder={string.Join(",", remainder)}");
      }
      This method can be registered as a Yarn command:
      dialogueRunner.AddCommandHandler<int, string[]>("my_command", LogStrings);
      And called from Yarn Spinner:
      // logs "a = 42, remainder=this,is,pretty,great"
      <<my_command 42 this is pretty great>> 
      

      [!NOTE]
      Array parameters are required to be the last parameter of the method.

  • Variable storage objects now allow registering a 'change listener' that runs when a variable is changed.
    • To add a change listener, call AddChangeListener on your variable storage, and provide the name of the variable you want to watch for changes for and a delegate that should run when the variable changes:

      VariableStorageBehaviour storage = // ...
      
      var changeListener = storage.AddChangeListener<bool>("$myVariable", (newValue) => {
        Debug.Log("$myVariable changed to " + newValue);
      });

      You can remove a change listener by disposing it:

      changeListener.Dispose();

      Change listeners can't be added for smart variables. If you add a change listener for a stored variable (that is, one declared in the Yarn script), the change listener's parameters must match the type of the stored variable.

      [!NOTE]
      If you're implementing your own subclass of VariableStorageBehaviour, your SetValue methods must call NotifyVariableChanged to notify any registered change listeners.

      public override void SetValue(string variableName, string newValue)
      {
          // ... existing behaviour ...
      
          NotifyVariableChanged(variableName, newValue);
      }
  • Added a sample (CustomSaliency) showing off making a custom saliency selection strategy.
  • Added a sample (InlineEvents) showing off using ActionMarkupHandler's to perform in line events.
  • Added a sample (Replacement Markers) showing off various different approaches to performing marker replacement.
  • The Dialogue System prefab now has support for some common rich text tags
    • [i] will italicise text
    • [b] will embolden text
    • [u] will underline text
    • [s] will strike through text
  • AsyncOptionsView now supports configuring its fade duration.
  • MarkupPalette and the associated PaletteMarkerProcessor now support custom TMP rich text tags beyond what the more basic markers allow.
  • LineMetadata now has public API methods for constructing and manually adding elements.
  • DialogueRunner.SetProject now sets the Program of its internal Dialogue object. Previously, this didn't happen until StartDialogue().
  • Added a sample (Advanced Saliency) making use of templated nodes and built in saliency to show off creating storylet vignettes.
  • IActionMarkupHandler interface which the ActionMarkupHandler monobehaviour now conforms to
  • Action markup handlers now has a OnLineWillDismiss method which is called right before the line view fades itself away.
  • LinePresenterButtonHandler is a new ActionMarkupHandler subclass that manages the continue button on the line view.

Changed

  • Fixed an issue where, on Windows, projects would fail to automatically update when a file that belonged to them was created or edited.
  • Fixed an issue where Unity Localization rid values would change on reimport when they didn't have to.
  • Fixed an issue where a [pause/] marker at the start of the line would cause all pauses to not work (@iatenothingbutriceforthreedays)
  • Inspector-exposed fields on LineView are now public.
  • Fixed an issue where a .meta file was causing warnings to appear in Unity on import. (@Colbydude)
  • Fixed an issue where functions would not be registered with the VM until after the first call to CommandDispatcher.
  • YarnProjectImporter.GenerateStringsTable is now public.
  • Yarn Projects now allow choosing more specific cultures (for example 'pt-BR' and 'en-AU' rather than simply 'pt' and 'en') as their base language.
  • DialogueRunner.dialogueCompleteTask now uses a completion source, rather than polling.
  • YarnNode dropdowns no longer show individual node group members in the list.
  • IActionRegistration now correctly supports commands without parameters.
  • Renamed TemporalMarkupProcessor to ActionMarkupHandler.
  • Renamed AttributeMarkerProcessor to ReplacementMarkupHandler
  • When using Unity Localization, Yarn Projects now populate the string table collection using a post-processor, rather that in the middle of import. This should fix errors that would occasionally cause string tables to not correctly update when a Yarn file changes.
  • Fixed an issue where the System.Threading.Tasks implementation of YarnTask.WaitUntil did not return early when the CancellationToken was cancelled (@dogboydog)
  • If a VoiceOverView is configured to automatically advance at the end of audio playback, when a line that has no AudioClip is delivered, the VoiceOverView will now advance the line immediately after logging an error.
  • Renamed FormatForMarker to PaletteForMarker in MarkupPalette.
  • Generated variable storage code now represents string values as signed integers, not unsigned integers. (Unity doesn't correctly serialize enum values over the signed integer maximum.)
  • YarnNode-attributed variables can now be configured to allow editing as a text field even when the Yarn Project is not set. This is now the default behaviour for DialogueReference.
  • sourceFilePaths on ProjectImportData renamed to be sourceFilePatterns because that is what it actually is.
  • Fixed a crash in project import when externally declared invalid functions had no associated file with the error
  • When an error that YarnProjectImportEditor needs to show has no file associated with it the editor no longer draws an empty TextAsset field.
  • Heavily reworked the structure of the project folders.
  • Renamed AsyncDialogueViewBase to be DialoguePresenter
    • Renamed AsyncLineView to be LinePresenter
    • Renamed AsyncOptionItem to be OptionItem
    • Renamed AsyncOptionsView to be OptionsPresenter
    • Renamed VoiceOverView to be VoiceOverPresenter
  • LanguageAttribute and YarnNodeAttribute are now in the Yarn.Unity.Attributes namespace.
  • Facial expressions on the NPCs now have more common names.
  • MoveEvent.cs now uses YarnTasks instead o...
Read more

v3.0.0-beta1

09 Mar 03:45

Choose a tag to compare

v3.0.0-beta1 Pre-release
Pre-release

Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron, or by buying a copy of Yarn Spinner on itch.io or the Unity Asset Store!

👩‍🚒 Getting Help

There are several places you can go to get help with Yarn Spinner.

📦 How To Install Yarn Spinner

To install the most recent release of Yarn Spinner for Unity, please see the Installation Instructions in the Yarn Spinner documentation.

If you want to install this particular version of Yarn Spinner for Unity, follow these steps:

Installing Yarn Spinner for Unity v3.0.0-beta1 from Git

  • Open the Window menu, and choose Package Manager.
  • If you already have any previous version of the Yarn Spinner package installed, remove it.
  • Click the + button, and click Add package from git URL...
  • Enter the following URL:
    • https://github.com/YarnSpinnerTool/YarnSpinner-Unity.git#v3.0.0-beta1

Each release will have a different URL. To upgrade to future versions of Yarn Spinner, you will need to uninstall the package, and reinstall using the new URL.

📜 Changes

Added

  • Added a Unity Project scoped settings that allows you to override some of the default behaviours of Yarn Spinner.
    • Yarn Spinner settings are saved to the path ProjectSettings\Packages\dev.yarnspinner\YarnSpinnerProjectSettings.json.
    • The settings be changed in the Project Settings window, by choosing Edit -> Project Settings -> Yarn Spinner.
    • The setting currently supports three convenience features of Yarn Spinner:
      • Automatically associating assets with localisations
      • Automatically linking YarnCommand and YarnFunction attributed methods to the Dialogue Runner.
      • Generating a .ysls.json file that stores information about your Yarn attributed methods.
        • This file is saved to ProjectSettings\Packages\dev.yarnspinner\generated.ysls.json.
        • This is an experimental feature to support better editor integration down the line. As such, this feature defaults to 'off'.
    • Enabling or disabling YarnCommand and YarnFunction linking, or .ysls generation, will cause your project to recompile.
    • Enabling or disabling asset linking will cause a reimport of all yarnproject assets.
  • Yarn.Unity.ActionAnalyser.Action now has a MethodIdentifierName property, which is the short form of the method name.
  • DialogueAdvanceInput now supports Virtual Button names in addition to KeyCodes and Input Actions.
    • This can be configured to work on button or key release or press. By default, the component works on release.
  • LineView now will add in line breaks when it encounters a self closing [br /] marker.
  • Yarn attributed Functions and Commands can now use constant values in addition to literals for their name.

Changed

  • Update the minimum Unity version to 2022.3.
  • Fixed a bug where line pauses could sometimes not happen when the user's framerate is low.
  • Fixed a bug where the Rounded Views sample wouldn't import correctly.
  • Fixed Minimal Dialogue Runner sample that was using obsolete methods.
  • Fixed a bug where TMPShim wasn't being detected.
  • Standard library functions (like random, dice, round_places, etc) have been moved to the core Yarn Spinner library.
  • Fixed a bug where the audio assets in the samples weren't being linked correctly resulting in playback errors.
  • Intro Sample: Moved the Character Color view to a new stand-alone object (it's easier to explain how to do this in a tutorial!)
  • Analyser no longer ignores non-public methods.
    • This is now handled during codegen side so we can better log it.
  • ActionsGenerator will now generate C# warnings for non-private methods that are attributed as YarnFunction or YarnCommand.
  • ActionsGenerator still logs to a temporary location, but now into a dev.yarnspinner.logs folder inside the temporary location.
  • Auto-advancing LineViews will no longer attempt to advance dialogue that has been stopped.
  • Actions Registration now dumps generated code into the same temporary folder the logs live in
  • ActionsGenerator will now generate C# warnings for incorrectly named methods that are attributed as YarnFunction or YarnCommand.
  • Fixed a bug where AudioLineProvider didn't allow runtime changing of the text locale.
  • Fixed a bug where the Unity Localisation strings tables would have duplicate lines after tagging all lines in a project.

Removed

  • Remove certain items that were previously marked as obsolete:
    • Obsolete method DialogueRunner.ResetDialogue
    • Obsolete property YarnFunctionAttribute.FunctionName
    • Obsolete property YarnCommandAttribute.CommandString
    • Obsolete method YarnProject.GetProgram
  • Removed YarnParameterAttribute and YarnStateInjectorAttribute.
    • These attributes were formerly used in earlier versions of Yarn Spinner's action system, but are no longer used.

v2.4.2

27 Feb 04:02

Choose a tag to compare

Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron, or by buying a copy of Yarn Spinner on itch.io or the Unity Asset Store!

👩‍🚒 Getting Help

There are several places you can go to get help with Yarn Spinner.

📦 How To Install Yarn Spinner

To install the most recent release of Yarn Spinner for Unity, please see the Installation Instructions in the Yarn Spinner documentation.

If you want to install this particular version of Yarn Spinner for Unity, follow these steps:

Installing Yarn Spinner for Unity v2.4.2 from Git

  • Open the Window menu, and choose Package Manager.
  • If you already have any previous version of the Yarn Spinner package installed, remove it.
  • Click the + button, and click Add package from git URL...
  • Enter the following URL:
    • https://github.com/YarnSpinnerTool/YarnSpinner-Unity.git#v2.4.2

Each release will have a different URL. To upgrade to future versions of Yarn Spinner, you will need to uninstall the package, and reinstall using the new URL.

📜 Changes

Added

  • Added a Unity Project scoped settings that allows you to override some of the default behaviours of Yarn Spinner.
    • Yarn Spinner settings are saved to the path ProjectSettings\Packages\dev.yarnspinner\YarnSpinnerProjectSettings.json.
    • The settings be changed in the Project Settings window, by choosing Edit -> Project Settings -> Yarn Spinner.
    • The setting currently supports three convenience features of Yarn Spinner:
      • Automatically associating assets with localisations
      • Automatically linking YarnCommand and YarnFunction attributed methods to the Dialogue Runner.
      • Generating a .ysls.json file that stores information about your Yarn attributed methods.
        • This file is saved to ProjectSettings\Packages\dev.yarnspinner\generated.ysls.json.
        • This is an experimental feature to support better editor integration down the line. As such, this feature defaults to 'off'.
    • Enabling or disabling YarnCommand and YarnFunction linking, or .ysls generation, will cause your project to recompile.
    • Enabling or disabling asset linking will cause a reimport of all yarnproject assets.
  • Yarn.Unity.ActionAnalyser.Action now has a MethodIdentifierName property, which is the short form of the method name.
  • DialogueAdvanceInput now supports Virtual Button names in addition to KeyCodes and Input Actions.
    • This can be configured to work on button or key release or press. By default, the component works on release.
  • LineView now will add in line breaks when it encounters a self closing [br /] marker.
  • Yarn attributed Functions and Commands can now use constant values in addition to literals for their name.

Changed

  • Update the minimum Unity version to 2021.3.
  • Fixed a bug where line pauses could sometimes not happen when the user's framerate is low.
  • Fixed a bug where the Rounded Views sample wouldn't import correctly.
  • Fixed Minimal Dialogue Runner sample that was using obsolete methods.
  • Fixed a bug where TMPShim wasn't being detected.
  • Standard library functions (like random, dice, round_places, etc) have been moved to the core Yarn Spinner library.
  • Fixed a bug where the audio assets in the samples weren't being linked correctly resulting in playback errors.
  • Intro Sample: Moved the Character Color view to a new stand-alone object (it's easier to explain how to do this in a tutorial!)
  • Analyser no longer ignores non-public methods.
    • This is now handled during codegen side so we can better log it.
  • ActionsGenerator will now generate C# warnings for non-private methods that are attributed as YarnFunction or YarnCommand.
  • ActionsGenerator still logs to a temporary location, but now into a dev.yarnspinner.logs folder inside the temporary location.
  • Auto-advancing LineViews will no longer attempt to advance dialogue that has been stopped.
  • Actions Registration now dumps generated code into the same temporary folder the logs live in
  • ActionsGenerator will now generate C# warnings for incorrectly named methods that are attributed as YarnFunction or YarnCommand.
  • Fixed a bug where AudioLineProvider didn't allow runtime changing of the text locale.
  • Fixed a bug where the Unity Localisation strings tables would have duplicate lines after tagging all lines in a project.

Removed

  • Remove certain items that were previously marked as obsolete:
    • Obsolete method DialogueRunner.ResetDialogue
    • Obsolete property YarnFunctionAttribute.FunctionName
    • Obsolete property YarnCommandAttribute.CommandString
    • Obsolete method YarnProject.GetProgram

v2.4.0

15 Nov 00:28

Choose a tag to compare

Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron!

👩‍🚒 Getting Help

There are several places you can go to get help with Yarn Spinner.

📦 How To Install Yarn Spinner

To install the most recent release of Yarn Spinner for Unity, please see the Installation Instructions in the Yarn Spinner documentation.

If you want to install this particular version of Yarn Spinner for Unity, follow these steps:

Installing Yarn Spinner for Unity v2.4.0 from Git

  • Open the Window menu, and choose Package Manager.
  • If you already have any previous version of the Yarn Spinner package installed, remove it.
  • Click the + button, and click Add package from git URL...
  • Enter the following URL:
    • https://github.com/YarnSpinnerTool/YarnSpinner-Unity.git#v2.4.0

Each release will have a different URL. To upgrade to future versions of Yarn Spinner, you will need to uninstall the package, and reinstall using the new URL.

📜 Changes

Added

In-Line Pause Support

  • The built-in Line View now can now identify markup based pauses and insert pauses into the typewriter effect.
    • To use this you can use the pause markup inside your lines:
      Alice: wow this line now has a halt [pause=500 /] inside of it
      
      • This line will stop the typewriter for 500ms after the halt is shown. After the 500ms delay, the rest of the line will appear.
    • Two new Unity events have also been added to be informed when pauses happen:
      • onPauseStarted
      • onPauseEnded
  • Added a new PausableTypewriter effect that works identically to the existing Typewriter effect, but supports arbitrary pauses. This effect can be used in your own custom line views to add support for the [pause/] markup.
  • To learn more about how the pause system works, take a look at the PausableTypewriter.GetPauseDurationsInsideLine method!

New Samples

  • Several new sample projects have been added:
    • Shot Reverse Shot shows how you can use Cinemachine virtual cameras and custom dialogue views to make a shot-reverse-shot scene in your game.
      YarnSpinner-Unity_ShotReverseShot

    • Sliced Views shows off a new alternative default line and option view prefab.
      YarnSpinner-Unity_RoundedViews

    • Markup Palette demonstrates the new MarkupPalette system.
      YarnSpinner-Unity_Palette

    • User Input and Yarn shows how you can use blocking commands and TMP Input fields to get input into Yarn variables.
      YarnSpinner-Unity_InputSampleScene

    • Pausing the Typewriter showing how you can use the [pause/] marker to temporarily pause in the middle of a line.
      YarnSpinner-Unity_Pausing

New Saving Features

  • Added two new basic save methods on DialogueRunner that use the persistent data storage location as their save location:
    • SaveStateToPersistentStorage saves all variables known to the Dialogue Runner to a named file in the Application.persistentDataPath folder.
      • These methods, SaveStateToPersistentStorage and LoadStateFromPersistentStorage are intended to replace the older PlayerPref based system for basic saves.
      • Note: For more complex games, we are still assuming you will need to craft your own bespoke save system.

Markup Palette System

  • The Line View and Options List View prefabs now support markup palettes, which allow you to customise the colours of your lines and options using Yarn Spinner's markup.

  • Markup Palettes let you associate a marker with a colour. When you use that marker in your dialogue, the text will be rendered using that colour.

  • For example, consider the following line:

    I'm [excited]thrilled to be here[/excited]!
    

    If you create a Markup Palette that links the word excited to the colour red, the words "thrilled to be here" will be red.

  • The built-in Line View and Options List View prefabs have support for Markup Palettes, as well as any custom Dialogue Views you build that use the LineView and OptionsListView classes.

Other Features

  • A new method (ClearLoadedAssets), which unloads all cached assets from the UnityLocalisedLineProvider, has been added.
    • This method will forcibly unload all assets. Only call this method if you're very familiar with the Addressable Assets system and are comfortable with Yarn Spinner's internals!
  • Projects can now provide a list of line IDs within a node, using GetLineIDsForNodes.
    • This is intended to be used to precache multiple nodes worth of assets, but might also be useful for debugging during development.
  • Newly created .yarnproject files now ignore any .yarn files that are in a folder whose name ends in '~', which follows Unity's behaviour.
    • You can customise this behaviour by opening the .yarnproject file in a text editor and modifying the excludeFiles property.
  • Added MarkupPalette scriptable object and support for the palette inside of LineView and OptionsListView and associated OptionView.
    • This is useful both as a standalone way to easily annotate your dialogue, but also as an example of the markup system.

Changed

  • Fixed a bug where YarnNode attributes would not display correctly in the Inspector when its property path is longer than 1.
  • Fixed a bug in the action registration source code generator that caused it to crash on certain files, which resulted in some commands not being registered at runtime.
  • Replaced the call to Yarn.Compiler.Utility.AddTagsToLines with Yarn.Compiler.Utility.TagLines.
  • Fixed incorrect order of generic parameter names for AddFunction methods. The usage of these functions is unchanged.
  • Fixed incorrect handling of line IDs inside the Unity Localised Line Provider preventing voice assets being loaded.
  • Fixed a crash where declaration statements without a value (<<declare $var>>) would crash the importer, leading to weird bugs.
  • Yarn Functions and Commands can now have up to 10 parameters if you need them. (Previously, the limit was 6.)
  • The hard dependency on Text Mesh Pro is now a soft one.
    • This change will only affect projects that do not have TextMeshPro installed in their project. For most projects, this change won't be noticed.
  • Dialogue Runner will now better wait for line providers to be ready before requesting lines.
    • This does have the potential issue of long load times for some larger nodes, in those cases we suggest you preload more lines using GetLineIDsForNodes on YarnProject
  • UnityLocalisedLineProvider can now have it's default setting of removing unused assets disabled, this is useful when caching multiple nodes worth of assets
  • The "Add Assets to Asset Table Collection" wizard now correctly prepends line: to the key, to match the documented behaviour.
  • OptionsListView now deactivates child options when they are not needed instead of just making them transparent.
  • When using Unity Localization, line metadata is now stored on the shared entry for a line ID, rather than only on the base language's entry. (This caused an issue where, if the game was not running in the base language, line metadata would not be available.)
  • Fixed an issue with AudioLineProvider that would prevent audio assets being loaded
  • Fixed an issue with the Project editor that prevented audio assets loading when using Addressables.
  • The Yarn Project inspector window will now log errors when your inspector width is considered too small.
    • We are pretty sure this is a bug in the UI code on Unity's end.
    • In our testing it happens at widths less than 319 pixels, because, sure, why not!
    • It also doesn't seem to happen in every version of Unity, so that's fun.
  • Setting a project on the dialogue runner will now also load the initial variables from this project, fixing this regression.
  • LineView now supports showing the character names as a standalone element.
    • The existing behaviour is still the same with the default prefabs
  • OptionsListView now supports showing the character names as a standalone element.
  • LineView now uses the PausableTypewriter by default.
    • If you don't use pauses, you won't need to change anything.
  • Effects.Typewriter now is a wrapper into the PausableTypewriter effect
    • If you don't use pauses nothing will change
  • Yarn Projects that have no import data will no longer suggest to upgrade the project file.
    • This sol...
Read more

v2.3.1

07 Jul 05:05

Choose a tag to compare

Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron!

👩‍🚒 Getting Help

There are several places you can go to get help with Yarn Spinner.

📦 How To Install Yarn Spinner

To install the most recent release of Yarn Spinner for Unity, please see the Installation Instructions in the Yarn Spinner documentation.

If you want to install this particular version of Yarn Spinner for Unity, follow these steps:

Installing Yarn Spinner for Unity v2.3.1 from Git

  • Open the Window menu, and choose Package Manager.
  • If you already have any previous version of the Yarn Spinner package installed, remove it.
  • Click the + button, and click Add package from git URL...
  • Enter the following URL:
    • https://github.com/YarnSpinnerTool/YarnSpinner-Unity.git#v2.3.1

Each release will have a different URL. To upgrade to future versions of Yarn Spinner, you will need to uninstall the package, and reinstall using the new URL.

Yarn Spinner 2.3

Get excited! Yarn Spinner 2.3 is here! Here’s an outline of what’s new since the previous release, 2.2. These release notes cover both Yarn Spinner for Unity, and the core Yarn Spinner compiler that Unity uses under the hood.

Yarn script changes

  • The Yarn Spinner compiler’s indentation tracking has been rewritten to be more consistent in how it works.
    • 🚨 Breaking Change: if statements must now all be at the same level of indentation as they’re corresponding else, elseif, and endif statements.
      • This was already strongly encouraged for readability, but is now a requirement.
      • If an if statement is at a different indentation level to its corresponding statements, a compiler error will now be generated.
      • The lines and other content inside an if statement can be indented as much as you like, as long as it’s not less indented than the initial if statement.
        • For example, the following code will work:
          // With indentation
          <<if $something>>
              A line!
          <<else>>
              A different line!
          <<endif>>
          
          // Without indentation
          <<if $something>>
          A line!
          <<else>>
          A different line!
          <<endif>>			
          
        • The following code will not work:
          // With indentation
          <<if $something>>
            A line!
            <<else>>
          A different line!
          <<endif>>			
          
    • 🚨Breaking Change: Empty lines between options now split up different option groups.
      • Previously, the following code would appear as a single option group (with the options ‘A’, ‘B’, ‘C’, ‘D’):
        -> A
        -> B
        
        -> C
        -> D		
        
      • In Yarn Spinner 2.3 and above, this will appear as two option groups: one containing the options ‘A’, ‘B’, and another containing ‘C’, ‘D’.
        • This change was made in response to user reports that the previous behaviour didn’t behave the way they expected.

New things

  • The .yarnproject importer has been updated to use new JSON-based Yarn Projects.

    • JSON-formatted Yarn Projects replace the previous format, which stored all import data in Unity’s .meta files. This helps us lay the groundwork for releases that support other engines. 👀
    • JSON-formatted Yarn Projects allow a single Yarn script to be used in multiple Yarn Projects, and also allow the Yarn Spinner compiler to support upcoming new features.
      • Yarn Project files contain information that the Yarn Spinner compiler can use to compile multiple Yarn scripts at the same time. Yarn Projects are designed to be used by game engines to identify how Yarn content should be imported into the game.
        • You can see an example of the format of these JSON-based Yarn Projects here.
    • Yarn scripts no longer need to be manually associated with a Yarn Project. If they are in the same folder, or a subfolder, of the Yarn Project, they will be included.
    • In Unity, you can add, modify, and delete source file patterns for Yarn projects in the Inspector.
    • When you update from an earlier version to 2.3, all Yarn scripts and Yarn Projects will be re-imported:
      • You will receive import errors on your existing Yarn Projects, telling you that your Yarn Project needs to be upgraded. To do this, follow the message’s instructions: select the project, and click Upgrade Yarn Project in the Inspector.
      • After upgrading your projects, you will need to set up your localisations again by adding them in the Yarn Project’s inspector and dragging in your strings file and asset file.
      • If your project uses any Yarn files that are not in the same folder, or subfolder, of the Yarn Project, you will need to move the Yarn files to the folder.
      • Your Yarn scripts, strings files, and localised assets will not be modified, and you won’t need to change any objects in your scenes or prefabs. The only thing that will be changed is the Yarn Project file.
  • In Unity, the Unity Localization integration is now available when the Localization package is installed.

    • Prior to this change, the YARN_USE_EXPERIMENTAL_FEATURES scripting definition symbol needed to be added to the Player settings.
  • You can now add a Dialogue System prefab to your scene by opening the GameObject menu and choosing Yarn Spinner -> Dialogue Runner.

  • Added ‘On Dialogue Start’ event to Dialogue Runner. This event is called when the dialogue starts running.

  • Methods tagged with the YarnCommand and YarnFunction attribute are now discovered at compile time, rather than at run-time. This makes game start-up significantly faster.

    • Yarn Spinner for Unity will search your source code for methods with the YarnCommand and YarnFunction attributes, and generate source code that registers these methods when the game starts up, or when you enter Play Mode in the editor.
    • This is a change from previous versions of Yarn Spinner for Unity, which searched for commands and functions at run-time, which had performance and compatibility implications on certain platforms (notably, consoles).
    • This search is done automatically in Unity 2021.2 and later. In earlier versions of Unity, you will need to manually tell Yarn Spinner for Unity to check your code, by opening the Window menu and choosing Yarn Spinner -> Update Yarn Commands.
    • In Unity 2021.2 and later, you can now see which commands have been registered using YarnCommand by opening the Window menu and choosing Yarn Spinner -> Commands…
  • Under the hood, Yarn Programs now store all headers for their nodes.

    • Prior to this change, only the tags header was stored.
  • DialogueReference objects can now be implicitly converted to strings.

  • The YarnNode attribute can be attached to a string property to turn it into a drop-down menu for choosing nodes in a Yarn Project:

    // A reference to a Yarn Project
    public YarnProject project;
    
    // A node in ‘project’
    [YarnNode(nameof(project))]
    public string node1;
    
    // Another node in ‘project’
    [YarnNode(nameof(project))]
    public string node2;
    
  • The YarnProject.GetHeaders method has been added, which fetches all headers for a node.

  • The YarnProject.InitialValues property has been added, which fetches a dictionary containing the initial values for every variable in the project.

Changed things

  • Node title verification now occurs at declaration time instead of code generation. This means invalid titles will be caught and presented as a problem earlier on, to aid in debugging issues.
  • Code completion in the Language Server has been completely rewritten. It is now much less flexible, but way more performant. For most situations, the changes will not be noticeable.
  • Fixed a crash in the Language Server when encountering declaration statements without a variable.
  • Fixed a bug in the Language Server that caused crashes when code-completion was requested at a position more than 50% of the way through a document.
  • The following event handlers on the Dialogue class, which were previously required to be set, are now optional and may be set to null:
    • LineHandler
    • CommandHandler
    • NodeStartHandler
    • NodeCompleteHandler
    • DialogueCompleteHandler
    • Note that OptionsHandler remains not optional, and is required to be set.
  • VM now nullifies its state when stopped. Previously, the VM's state would persist after the Stop method is called.
  • Fixed a compile error in the Minimal Viable Dialogue System sample in Unity 2019.
  • Added code to invalidate the Program cache on awake for Yarn Projects properly. This means your Yarn Projects will be correctly compiled and referenced in the editor.
  • Dialogue Runner will now report an error and stop early if you tell it to start running a node that isn’t in th...
Read more

v2.3.0-beta2

17 May 07:38

Choose a tag to compare

v2.3.0-beta2 Pre-release
Pre-release

Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron!

👩‍🚒 Getting Help

There are several places you can go to get help with Yarn Spinner.

📦 How To Install Yarn Spinner

To install the most recent release of Yarn Spinner for Unity, please see the Installation Instructions in the Yarn Spinner documentation.

If you want to install this particular version of Yarn Spinner for Unity, follow these steps:

Installing Yarn Spinner for Unity v2.3.0-beta2 from Git

  • Open the Window menu, and choose Package Manager.
  • If you already have any previous version of the Yarn Spinner package installed, remove it.
  • Click the + button, and click Add package from git URL...
  • Enter the following URL:
    • https://github.com/YarnSpinnerTool/YarnSpinner-Unity.git#v2.3.0-beta2

Each release will have a different URL. To upgrade to future versions of Yarn Spinner, you will need to uninstall the package, and reinstall using the new URL.

📜 Changes

Added

  • The .yarnproject importer has been updated to use new JSON-formatted Yarn Projects.

    • JSON-formatted Yarn Projects replace the previous format, which stored all import data in Unity's .meta files.
    • JSON-formatted Yarn Projects allow a single Yarn script to be used in multiple Yarn Projects, and also allow the Yarn Spinner compiler to support upcoming new features.
    • Yarn scripts no longer need to be manually associated with a Yarn Project. If they are in the same folder, or a subfolder, of the Yarn Project, they will be included.
    • When you update to 2.3.0-beta2, all Yarn scripts and Yarn Projects will be re-imported.
      • You will receive import errors on your existing Yarn Projects, telling you that your Yarn Project needs to be upgraded. To do this, follow the message's instructions: select the project, and click Upgrade Yarn Project in the Inspector.
      • After upgrading your projects, you will need to set up your localisations again by adding them in the Yarn Project's inspector and dragging in your strings file and asset file.
      • If your project uses any Yarn files that are not in the same folder, or subfolder, of the Yarn Project, you will need to move the Yarn files to the folder.
      • Your Yarn scripts, strings files, and localised assets will not be modified, and you won't need to change any objects in your scenes or prefabs. The only thing that will be changed is the Yarn Project file.
  • For more information on the new Yarn Project file format, see the changelog for the Yarn Spinner compiler.

  • The Unity Localization integration is now available when the Localization package is installed.

    • Prior to this change, the YARN_USE_EXPERIMENTAL_FEATURES scripting definition symbol needed to be added to the Player settings.
  • You can now add a Dialogue System prefab to your scene by opening the GameObject menu and choosing Yarn Spinner -> Dialogue Runner.

  • Added 'On Dialogue Start' event to Dialogue Runner. This event is called when the dialogue starts running. (@nrvllrgrs)

Changed

  • Dialogue Runner will now report an error and stop early if you tell it to start running a node that isn't in the provided Yarn Project.
  • Dialogue Runner's 'On Dialogue Complete' event will now fire when you stop it via by calling the Stop() method.