Skip to content

v2.3.0-beta1

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 06 Mar 06:23

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.