Skip to content

Adding a dialogue for an NPC

Overview

In this tutorial, you will learn how to:

  • Add dialogues to the dialogue pool
  • Attach the dialogue to a non-character player (NPC)
  • Trigger the conversation in the game

Preparing dialogues

  1. In the Explorer window, add dialogues to the dialogue pool by choosing Gameplay > + New Dialogue.

    add-to-dialog-pool

  2. Populate the dialogue.

    Field Description
    Name The name of the dialogue. The name is the first text that a player sees when the conversation is activated.
    Sentence Sentences that speakers say during the conversation. You can add as many sentences as you like.
    NPC/Player This is the speaker type you can specify. You can create a consecutive conversation with it.
    Text The content of the sentence

    populate-dialog

  3. Add another dialogue by choosing the + icon.

    Add-a-dialog

Creating an NPC and attaching a dialogue to it

  1. Find a model in Asset Library and place it in the scene.

    place-model-scene

  2. Make the model an NPC by attaching a Character component to it.

    attach-character-component

  3. Add a Dialogue component to the NPC and select a dialogue from the dialogue pool. You can make the dialogue repetitive or one-off.

    add-dialog-component

    configue-dialog

Adding a trigger for the convesation

  1. On the pane of the Dialogue component, set the trigger for the conversation. The default condition of the trigger is self-trigger on start.
  2. Set the trigger condition to Touched by player. You can also try another condition and see how it works in your Space.

    dialog-trigger

  3. Now you can playtest it by switching to Play Mode.

    playtest-dialog