v3.0.0-beta2
Pre-releaseYarn 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.
- Join the Yarn Spinner Discord.
- Talk to us via BlueSky or Mastodon
- 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:
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.UnityLocalisedLineProviderno longer throws an exception if an asset table is provided but does not contain an asset for a line.DialogueRunner.CommandDispatcheris now set up on first access, rather than inAwake.- This allows other objects to work with the command dispatcher (for example, registering new methods) in their
Awakemethods, even if theirAwakemethods run beforeDialogueRunner's.
- This allows other objects to work with the command dispatcher (for example, registering new methods) in their
YarnCommandandYarnFunctioncommands now allow including.characters in their names.- Fixed an issue in SerializableDictionary.cs that caused builds to fail.
DialogueRunner.AddCommandHandlerandDialogueRunner.AddFunctionnow validate that the provided names contain no spaces.DialogueRunner.AddCommandHandlernow 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:
This method can be registered as a Yarn command:
void LogStrings(int a, string[] remainder) { Debug.Log($"a = {a}, remainder={string.Join(",", remainder)}"); }
And called from Yarn Spinner:dialogueRunner.AddCommandHandler<int, string[]>("my_command", LogStrings);
// 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.
- This allows for commands with a variable list of parameters. For example, consider the following method:
- Variable storage objects now allow registering a 'change listener' that runs when a variable is changed.
-
To add a change listener, call
AddChangeListeneron 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 ofVariableStorageBehaviour, yourSetValuemethods must callNotifyVariableChangedto 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
AsyncOptionsViewnow supports configuring its fade duration.MarkupPaletteand the associatedPaletteMarkerProcessornow support custom TMP rich text tags beyond what the more basic markers allow.LineMetadatanow has public API methods for constructing and manually adding elements.DialogueRunner.SetProjectnow sets theProgramof its internalDialogueobject. Previously, this didn't happen untilStartDialogue().- Added a sample (Advanced Saliency) making use of templated nodes and built in saliency to show off creating storylet vignettes.
IActionMarkupHandlerinterface which theActionMarkupHandlermonobehaviour now conforms to- Action markup handlers now has a
OnLineWillDismissmethod which is called right before the line view fades itself away. LinePresenterButtonHandleris a newActionMarkupHandlersubclass 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
ridvalues 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
LineVieware now public. - Fixed an issue where a
.metafile 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.GenerateStringsTableis 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.dialogueCompleteTasknow uses a completion source, rather than polling.YarnNodedropdowns no longer show individual node group members in the list.IActionRegistrationnow correctly supports commands without parameters.- Renamed
TemporalMarkupProcessortoActionMarkupHandler. - Renamed
AttributeMarkerProcessortoReplacementMarkupHandler - 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
VoiceOverViewis configured to automatically advance at the end of audio playback, when a line that has noAudioClipis delivered, theVoiceOverViewwill now advance the line immediately after logging an error. - Renamed
FormatForMarkertoPaletteForMarkerinMarkupPalette. - 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 forDialogueReference.sourceFilePathsonProjectImportDatarenamed to besourceFilePatternsbecause 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
YarnProjectImportEditorneeds 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
AsyncDialogueViewBaseto beDialoguePresenter- Renamed
AsyncLineViewto beLinePresenter - Renamed
AsyncOptionItemto beOptionItem - Renamed
AsyncOptionsViewto beOptionsPresenter - Renamed
VoiceOverViewto beVoiceOverPresenter
- Renamed
LanguageAttributeandYarnNodeAttributeare now in theYarn.Unity.Attributesnamespace.- Facial expressions on the NPCs now have more common names.
MoveEvent.csnow uses YarnTasks instead ofAwaitableActionMarkupHandlernow conforms to theIActionMarkupHandlerinterfaceLinePresenternow has a public list ofIActionMarkupHandlerfor non-monobehaviour based markup handling.PauseEventProcessoris now just anIActionMarkupHandlerand no longer a monobehaviour.- Fixed a bug that could cause multiple option items to be selected at once.
- The awaitable version of
YarnTask.Delayno longer throws anOperationCancelledExceptionwhen cancelled.
Removed
YarnProject.GetHeadersis now deprecated, in favour ofDialogueRunner.Dialogue.GetHeaders.- Removed
TypewriterHandler; this behaviour is now intrinsic to theAsyncLineView. - Removed the
tagsheader 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
