Skip to content

Releases: YarnSpinnerTool/YarnSpinner-Unity

v2.4.2

27 Feb 04:02
Compare
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
Compare
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
Compare
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
Compare
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.

v2.3.0-beta1

06 Mar 06:23
Compare
Choose a tag to compare
v2.3.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!

👩‍🚒 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-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#v2.3.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

Breaking 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 their 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.

Added

  • 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...

  • 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

  • Fixed a compile error in the Minimal Viable Dialogue System sample in Unity 2019.

v2.2.4

27 Jan 03:58
Compare
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.2.4 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.2.4

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

Changed

  • Number pluralisation rules have been updated. The rules have now use CLDR version 42.0 (previously, 36.1)
  • Fixed an issue where pluralisation markup (i.e. the plural and ordinal tags) would not work correctly with country-specific locales (for example "en-AU").

v2.2.3

14 Nov 05:20
Compare
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.2.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#v2.2.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

Changed

  • Dependency DLLs are now aliased to prevent compilation errors with Burst.
    • In v2.2.2, Yarn Spinner's dependency DLLs were renamed to have the prefix Yarn. to prevent errors when two DLLs of the same name (e.g. Google.Protobuf.dll) are present in the same project.
    • This fix solved the edit-time problem, but introduced a new error when the project used Unity's Burst compiler, which looks for DLL files based on their assembly name.
    • When compiling with Burst, Unity looks for the DLL file based on the name of the assembly, so when it goes searching for (for example) Google.Protobuf, it will only look for the file Google.Protobuf.dll, and not the renamed file.
    • With this change, the update_dlls.yml build script, which pulls in the latest version of Yarn Spinner and its dependencies, now uses the dotnet-assembly-alias tool to rename the DLLs and their assembly names.

v2.2.2

31 Oct 06:29
Compare
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.2.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.2.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 DialogueReference class, which stores a reference to a named node in a given project (and shows a warning in the Inspector if the reference can't be found) has been added. Thanks to @sttz for the contribution!
  • Initial work on support for the Unity Localization system has been added.
    • These features are currently behind a feature flag. They are not yet considered ready for production use, and we aren't offering support for it yet.
    • To access them, add the scripting define symbol YARN_ENABLE_EXPERIMENTAL_FEATURES. You should only do this if you know what this involves.
    • Yarn Project importer now has initial support for Unity's Localization system.
    • A new localised line provider subclass, UnityLocalisedLineProvider.cs has been added.

Changed

  • Fixed interrupt token handling in VoiceOverView that would cause it to permanently stop a Dialogue Runner's ability to progress through dialogue lines.
  • Fixed an issue where lines and options that contain invalid markup would cause an exception to be thrown, breaking dialogue. A warning message is now logged instead, and the original text of the line (with any invalid markup present) is delivered.
  • Fixed a compiler error that made Yarn Spinner fail to compile on Unity 2020.1.
  • The AddCommandHandler(string name, Delegate handler) and AddFunction(string name, Delegate handler) methods on DialogueRunner are now public.
    • These methods allow you to register a Delegate object as a command or function.

      Note:
      We recommand that you use the pre-existing AddCommandHandler and AddFunction methods that take System.Action or System.Func parameters unless you have a very specific reason for using this, as the pre-existing methods allow the compiler to do type-checking on your command and function implementations.

  • Fixed an issue that would cause compilation errors if a Unity project using Yarn Spinner also used a DLL with the same name as one of Yarn Spinner's dependencies (for example Google Protocol Buffers).
    • The dependency DLLs that come with Yarn Spinner (for example, Antlr.Runtime, Google.Probuf, and others) have been renamed to have the prefix Yarn., and the assembly definition files for Yarn Spinner have been updated to use the renamed files.
    • Huge thanks to @Sygan for finding and describing the fix for this problem!
  • The YarnProject.GetProgram() method has been replaced with a property, Program.
    • GetProgram() still exists, but has been marked as obsolete and will be removed in a future release of Yarn Spinner.
    • YarnSpinner.Program has better performance, because it caches the result of de-serializing the compiled Yarn Program.

v2.2.1

14 Jun 06:05
Compare
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.2.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.2.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

Changed

  • Fixed an issue where Yarn projects that made use of the visited or visit_count functions could produce errors when re-importing the project.

v2.2.0

27 Apr 05:30
Compare
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.2.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.2.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 simple, built-in system for saving and loading Yarn variables to the built-in PlayerPrefs object has been added.
    • Call DialogueRunner.SaveStateToPlayerPrefs to save all variables to the PlayerPrefs system, and DialogueRunner.LoadStateFromPlayerPrefs to load from PlayerPrefs into the variable storage.
    • These methods do not write to file (except via PlayerPrefs, which handles disk writing on its own), and only work with variables (and not information like which line is currently being run.)
  • Metadata for each line is exposed through a Yarn Project. Metadata generally comes as hashtags similar to #line. They can be used to define line-specific behavior (no particular behavior is supported by default, each user will need to define their own).
  • When exporting Strings files, a Yarn Project will also export another CSV file with the line metadata (for each line with metadata).
  • LocalizedLines now contain a field for any metadata associated with the line.
  • YarnFunction tagged methods now appear in the inspector window for the project, letting you view their basic info.

Changed

  • YarnPreventPlayMode no longer uses WeakReference pointing to Unity.Object (this is unsupported by Unity).
  • ActionManager no longer logs every single command that it registers. (#165)
  • Line view should no longer have unusual interactions around enabling and disabling different effects (#161 and #153).
  • Fixed exception when viewing a Yarn Project in the inspector that contains no declarations, in Unity 2021.2 and earlier (#168)
  • Improved the type inference system around the use of functions.

This has two pieces, the first is in YarnSpinner Core and adds in support for partial backwards type inference.
This means in many situations where either the l-value or r-value of an expression is known that can be used to provide a type to the other side of the equation.
Additionally now functions tagged with the YarnFunction attribute are sent along to the compiler so that they can be used to inform values.
The upside of this is in situations like <<set $cats = get_cats()>> if either $cats is declared or get_cats is tagged as a YarnFunction there won't be an error anymore.

Removed

  • The SerializeAllVariablesToJSON and DeserializeAllVariablesFromJSON methods have been removed.
    • If you need a simple way to save all variables, use DialogueRunner.SaveStateToPlayerPrefs and DialogueRunner.LoadStateFromPlayerPrefs instead, which save directly to Unity's PlayerPrefs system and don't require reading or writing files.
    • If your saving or loading needs are more complex, use the VariableStorageBehaviour class's GetAllVariables() and SetAllVariables() methods to get and set the value of all values at once, and handle the serialization and deserialization the way your game needs it.