github YarnSpinnerTool/YarnSpinner-Unity v2.2.0

latest releases: v2.4.2, v2.4.0, v2.4.1...
2 years ago

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.

Don't miss a new YarnSpinner-Unity release

NewReleases is sending notifications on new releases.