The Unity Bark UI component uses Unity UI to display the text on a canvas. Typically this is a world space canvas above the NPC's head.
The Prefabs/Bark UI
folder contains some sample prefab bark UIs that you can add to an NPC.
To create your own:
- Create a canvas on a child GameObject of the NPC.
- Add a Text component to hold the bark text. In the screenshot below, this is on a child GameObject named Bark Text.
- (Optional) Add a Text component to hold the NPC's name, if you want to show the NPC's name with the bark text.
- (Optional) Add a continue button, if you want to require the player to click continue to close the bark canvas.
- (Optional) You can add other UI components, too, such as a background image.
- (Optional) Add an Animator, and assign an animator controller that contains animations to show and hide the canvas (e.g., fade in/out, expand/shrink, etc.).
- (Optional) Add an Always Face Camera component (Component > Dialogue System > Actor > Always Face Camera). This keeps the canvas facing the player's camera. You may want to tick YAxis Only.
- Add a Unity UI Bark UI component. Assign the Text components and configure the other settings with the behavior you want to use for barks.
- If you added a continue button, tick Wait For Continue Button, and point the button's On Click () event to UnityUIBarkUI.OnContinue.
The final component setup should look similar to this:
Script reference: PixelCrushers.DialogueSystem.UnityUIBarkUI
<< Unity GUI Bark UI | Textless Bark UI >>