A dialogue and event controller, responsible for managing configured dialogue and events. Often refereed to as the ‘NPC Chat object’ throughout this documentation. Place this object in a scene and use it’s collider, input or custom script reference to start a chat conversation.
|Assets\TurnTheGameOn\NPC Chat\Resources\NPC Chat.prefab|
The first step when configuring a dialogue event will be to add the NPC Chat object to your scene. This can be done in any of 3 ways:
- Drag and drop the prefab from the Project window into the Hierarchy
- Right Click in Hierarchy, select “UI > NPC Chat > NPC Chat Object”
- Select “GameObject > UI > NPC Chat > NPC Chat Object” from the Unity Menu Bar
NPC Chat has 2 different Chat Type modes, Default and Structured.
The Default Chat Type provides a simple interface to configure a single page of dialogue or notification.
Default – NPC Chat Inspector Variables:
|Chat Manager||A ScriptableObject, primarily used for setting current conversations when using the Structured Chat Type. Also used to limit the NPC Chat objects from starting dialogue at the same time.|
|NPC Chat Options||A ScriptableObject, used to hold NPC Chat settings as a profile.|
|Player||Player Transform, used for distance checking the player from the NPC to determine outline/interact-able state.|
|Chat Type||Default or Structured.|
|Chat Box||Chat Box to display page dialogue.|
|Title Text||String that populates the Title Text of the dialogue page’s assigned Chat Box.|
|Dialogue Text||String that populates the Dialogue Text of the dialogue page’s assigned Chat Box.|
|Page Audio||Assign an Audio Clip to be played when the page dialogue starts.|
|Page Buttons||Enable up to 6 buttons on the dialogue page’s assigned Chat Box. Assign button Text and button Events through this inspector.|
|OnChat Start/Stop Events||Assign callback events to be triggered when a conversation is started or stopped.|
|Outline||Mesh, Skinned Mesh or Sprite Renderers to be outlined with configured NPC Chat Options Outline settings.|
The Structured Chat Type provides a more advanced interface that can be used to add more pages of dialogue and create additional conversations. This chat type will use the assigned Chat Manager NPC Conversation Index that matches it’s NPC Number when chat is started.
Structured- NPC Chat Inspector Variables:
|NPC Number||The index that will be used with the Chat Manager to determine which conversation will be used when chat is started.|
|Conversations||Set the number of conversations the NPC will have, press Update to apply the new value.|
|Conversation Index||Current conversation being edited, press – and + to navigate between available conversations.|
|Chat Pages||Set the number of pages the Conversation will have, press Update to apply the new value.|
|Use Next Dialogue||Automatically set a specified conversation index after current conversation completes.|
|Next Dialogue||The next conversation index that will be assigned after current conversation completes.|
|Conversation Index Page||Current conversation page being edited, press – and + to navigate between available pages.|
|Page Events||Assign callback events to be triggered when current conversation index page is started or stopped.|