In the Hierarchy, right-click and create UI Document with “UI Toolkit/UI Document”.Select it, and choose “UIToolKitBasePanel” for the Panel Settings field, and “UIToolKitBase” for the Source Asset field. These two come prepackaged with Parley to make things easier for you to get started.
Create a folder at Resources/English/Emotions/Create the following file inside it:
en.Example.yaml
Dialogue: node_1: Speaker: "Mike" Emotion: "Neutral" Text: "Hi, I heard you wanted to see my emotional range." NextNode: node_2 node_2: Speaker: "Mike" Emotion: "Happy" Text: "This is me happy" NextNode: node_3 node_3: Speaker: "Mike" Emotion: "Sad" Text: "This is me sad" NextNode: node_4 node_4: Speaker: "Mike" Emotion: "Angry" Text: "And this is me angry!"
Back in the unity editor, add that script to the UI Document object we made earlier in the UI section, and click on the “Add Component” button and add a “UI ToolKit Handler” script, this also comes with Parley to handle all the functions we use to set UITK scenes.Assign the UI Document field in the UI ToolKit Handler component to the UI Document component above it.In the Graph Emotions UI ToolKit script, set the UI Took Kit Handler component to the UI ToolKit Handler component we added earlier. And create 4 sprite entries with the exact same emotions in the file, and assign each sprite.You should be left with something like this:
Back in the unity editor, add that script to the UI Document object we made earlier in the UI section, and click on the “Add Component” button and add a “UI ToolKit Handler” script, this also comes with Parley to handle all the functions we use to set UITK scenes.Assign the UI Document field in the UI ToolKit Handler component to the UI Document component above it.In the Graph Emotions UI ToolKit script, set the UI Took Kit Handler component to the UI ToolKit Handler component we added earlier. And create 4 sprite entries with the exact same emotions in the file, and assign each sprite.You should be left with something like this:
Hit play. Left click in the Game View to advance through the dialogue — you should see the speaker and text update with each click, the sprite gets set, and the dialogue ends cleanly on the last node.