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.
- Join the Yarn Spinner Discord.
- Tweet at us, at @YarnSpinnerTool.
- To report a bug, file an issue on GitHub.
📦 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:
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.
Installing Yarn Spinner for Unity v2.2.0 from Git
+
button, and click Add package from git URL...
https://github.com/YarnSpinnerTool/YarnSpinner-Unity.git#v2.2.0
📜 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 thePlayerPrefs
system, andDialogueRunner.LoadStateFromPlayerPrefs
to load fromPlayerPrefs
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.)
- Call
- 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).
LocalizedLine
s 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 usesWeakReference
pointing toUnity.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
andDeserializeAllVariablesFromJSON
methods have been removed.- If you need a simple way to save all variables, use
DialogueRunner.SaveStateToPlayerPrefs
andDialogueRunner.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'sGetAllVariables()
andSetAllVariables()
methods to get and set the value of all values at once, and handle the serialization and deserialization the way your game needs it.
- If you need a simple way to save all variables, use