Skip to content

v3.0.0-beta2

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 09 Mar 03:46

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 of Awaitable
  • ActionMarkupHandler now conforms to the IActionMarkupHandler interface
  • LinePresenter now has a public list of IActionMarkupHandler for non-monobehaviour based markup handling.
  • PauseEventProcessor is now just an IActionMarkupHandler and no longer a monobehaviour.
  • Fixed a bug that could cause multiple option items to be selected at once.
  • The awaitable version of YarnTask.Delay no longer throws an OperationCancelledException when cancelled.

Removed

  • YarnProject.GetHeaders is now deprecated, in favour of DialogueRunner.Dialogue.GetHeaders.
  • Removed TypewriterHandler; this behaviour is now intrinsic to the AsyncLineView.
  • Removed the tags header from the template new yarn file as it is no longer the best way to add metadata headers into a node.
  • Removed Continue Button support from the LinePresenter