The CharacterStorage is a cache for all
Characters defined in your
yarn scripts. This container is populated from the
commands as the YarnProject parses the input scripts.
true if a character with the given name or alias was defined.
Retrieves the character with the given name/alias, or returns
such character was not present.
Clear all characters from storage.
This could be used between scenes in preparation for loading a new set of characters. It would not generally be used while a dialog is in progress.
Remove a character by name. Its aliases will also be removed.
This could be used if you are certain a character is no longer required. It would not generally be used while a dialog is in progress.
Accessing character storage¶
Character storage is accessed via the YarnProject.
final characters = yarnProject.characters;
There may be situations where characters need to be removed from storage. For example, in a game with many scenes, characters could be removed after a scene and new characters loaded for the next scene.
Remove all characters with
remove to remove a single character. Pass in the name of the character or any of its
aliases. The character and all its aliases will be removed.