A visual novel/point-and-click game template using Yarn Spinner and Unity 2020.
Alice: Hi
Hi, Alice is still talking
Bob: Now Bob's talking!
I'm [shake s=2]shaking[/shake]
TextAttributeHandler.cs
Player: Look! <size=150%>Big</size> text!
See CustomStorage.cs
, SaveData.cs
VisualsManager.cs
in scene loaded with Load
command<<View {SPRITE NAME}>>
CharacterManager.cs
in scene loaded with Load
command<<Show {CHARACTER NAME} {EXPRESSION}>>
<<Change {CHARACTER NAME} {EXPRESSION}>>
<<Hide {CHARACTER NAME}>>
<<Load {SCENE NAME}>>
<<PlayMusic {AUDIOCLIP NAME}>>
<<StopMusic>>
<<SetTimed false>>
<<SetTimer 2>>
RelationshipUI.cs
, VarUI.cs
<<Take {ITEM} 1>>
<<Drop {ITEM} 1>>
<<if has("{ITEM}") is true>>
<<SetTime 9:45PM>>
<<AddMinutes 100>>
As well as others that are expected, like wait
, visited()
, etc.
{SCENE_NAME}
{SCENE_NAME}
that contains setup commands (e.g. PlayMusic
, View
, etc)See Office
scene as example.
{CHARACTER NAME}
to CharacterName
enumCustomStorage.defaultVariables
dictionary where key is {CHARACTER NAME}
CharacterManager.cs
in scene where character will appearCharacter
prefab to scene where character will appearCharacterManager.characterUiDictionary
Character
controllerSee Ana
and Hunter
in Office
scene as examples.
Note: The new character will appear in the relationships UI. If this is not wanted, you can write logic for that in RelationshipUI.cs
.
{EXPRESSION}
to Expression
enum{EXPRESSION}
trigger parameter to Character.controller
Scripts/Inventory/Items
folder, right click, then Create/ScriptableObjects/ItemData
yarnValues
will add or subtract to the corresponding yarn variable when added or removed from inventory. Important: All keys in Yarn Values must be keys in CustomStorage.defaultVariables
and represent a numerical yarn variable.See Headphones
as example.
First:
DialogueType
enum accordinglyTextAttributeHandler.SetDialogueGivenLine
If new DialogueGroup will show options:
ThinkDialogue
in Main
scene.CustomDialogueUI.cs.DoRunOptions
to have logic to show the new DialogueGroup.Else:
PlayerDialogue
in Main
scene.Note: Notice OtherDialogue
in Main
doesn't have a Canvas
component so it can be parented to characters. If that's the intention, perhaps duplicate that DialogueGroup instead.
TextAttributeHandler attributes
TextAttributeHandler.HandleAttribute
Note: If want to handle attribute before OnLineParsed
event is raised, look into CustomDialogueUI.TryParseCharacter
logic instead.
Parallax effect can be achieved in several ways:
CinemachineVirtualCamera
Note: If parallaxing Unity UI, set canvas's Render Mode
to World Space
and set worldCamera
to BgCamera
.
All inputs are defined in UIActions.inputactions
.
ClosableUI
allows for shortcut keys for closing/opening by listening to the action named shortcutActionName
.
Scripts/Inventory/Items
folder, right click, then Create/ScriptableObjects/TooltipData
title
field corresponds to an UIAction
action name, then the stringified action for the current input scheme will be displayed.SaveData.cs
contains all save data, and is serialized every time DialogueRunner.onDialogueComplete
is raised.
CustomStorage.cs
contains the logic for saving/loading SaveData
.
To modify:
SaveData.cs
UseSaveData
or UseSaveDataOnPlay
SaveDataListeners
, SaveDataListenersOnPlay
, or PrepareSaveData
OptionsTimed.anim
must be around 1 secondThanks to @radiatoryang's examples, @Michsky's lomenui, and the Yarn Spinner team! I've wanted a dialogue framework that's thin and expandable yet still powerful for awhile now.
All scripts, shaders, and scene files are distributed under the MIT license.
All art assets are under exclusive copyright; they'll be used for future games. If they're used/sold, I will find you 👀