NPCs and other interactive objects are usually represented by in-game avatars, although this isn't absolutely required for the Dialogue System. This page contains instructions that you can follow to set up an NPC or an interactive object such as a computer terminal. The rest of this page refers to "NPC", but the same procedures apply to interactive objects.
In addition to the typical Unity components such as a renderer and possibly a collider and/or trigger, NPCs in the Dialogue System usually have these types of components:
Component Type | Description |
---|---|
Usable | Marks the NPC "usable," meaning the player can target it and send "OnUse" messages |
Bark UI | Displays barks. Only applicable if the NPC is configured to bark |
SetEnabled Controllers | Optionally disable components (such as AI movement) during conversations |
Modifiers | Modify how the player works in the Dialogue System, such as specifying the player's default camera angle |
Persistent Data | Saves info in saved games and between level changes. Only applicable if you use the Save System |
The NPC Setup Wizard will automatically add the appropriate Dialogue System components to your NPC to give it the behavior that you specify. This is usually the easiest way to set up your NPC.
To use the wizard, select Window > Dialogue System > Wizards > NPC Setup.
Each page of the wizard contains an explanation of the options available to you.
Configure each page as appropriate for your project. Here are some notes:
The rest of this page describes the component types in more detail and explains how to add them manually.
The Usable component marks an NPC "usable," which allows the player to target it with a Selector or Proximity Selector and send an "OnUse" message.
More information: Usable
A bark UI displays barks, which are one-off lines of dialogue that are not part of an interactive conversation. The bark UI can be written for any GUI system. The Dialogue System includes bark UIs for Unity GUI, NGUI, Daikon Forge GUI, 2D Toolkit UI, etc.
If you only want one NPC in a group to bark at a time, use Bark Groups.
More information: Bark UI
If you've marked the NPC as "usable", add one or more triggers that respond to the "OnUse" message, such as Conversation Trigger or Bark Trigger.
You can add multiple triggers with different trigger conditions on each.
You can also add Bark On Idle if you want the NPC to bark on a timed interval, independent of being used by the player.
More information:
When the NPC is in a conversation, you will often want to temporarily turn off components such as AI wander scripts. The Set Component Enabled On Dialogue Event component can be configured to disable these components when a conversation starts, and then re-enable them when the conversation ends.
By default, conversations use the name of the NPC GameObject as the NPC's name. This name is used in portrait labels and is the value assigned to Variable["Conversant"]
. You can specify a different name by adding an Override Actor Name component.
If your dialogue UI uses the NPC Portrait Name field (or PC Portrait Name field for players), the text will be set according to these rules:
Every actor has a default camera angle that cutscene sequences can reference. Unless specified otherwise, the angle is "Closeup". You can change the NPC's angle by adding a Default Camera Angle component. For example, if the NPC is terrifying giant, you might want the default angle to be "Up" to convey that the PC must look up at him.
Persistent data components are only applicable if you use the Save System. They're described in detail in the Save System section.
You can put Components On Child GameObjects.
<< How to Set Up the Player (PC) | How to Start Conversations >>