How to Set Up the Player (PC)

The PC is usually represented by an in-game avatar, although this isn't absolutely required for the Dialogue System. This page contains instructions that you can follow to set up a PC avatar.

Overview

In addition to the typical Unity components such as a renderer and a collider, PCs in the Dialogue System usually have these types of components:

Component Type Description
Movement Controllers Allow the player to move the PC. You can use one of the controllers provided in the Dialogue System or your own controller
Camera Controllers Allow the player to control the camera. The Dialogue System includes an open-source camera controller from the Unity community wiki, but you can also use your own
Selectors Allow the player to target and "use" NPCs and interactive objects
SetEnabled Controllers Optionally disable movement and camera controllers during conversations so the player can't walk away mid-conversation
Modifiers Modify how the player works in the Dialogue System, such as specifying the player's default camera angle
Persistent Data Saves PC info in saved games and between level changes. Only applicable if you use the Save System

Player Setup Wizard

The Player Setup Wizard will automatically add the appropriate Dialogue System components to your PC to give it the behavior that you specify. This is the easiest way to set up your PC.

To use the wizard, select Window > Dialogue System > Wizards > Player 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:

  • If your player doesn't already have a control system, choose one of the sample control systems.
  • If your player doesn't already have a camera system, tick Use Smooth Follow Camera.
  • Choose a targeting method. This specifies how the player will send "OnUse" messages to usable targets such as NPCs.
  • You will usually want to disable player movement and camera control during conversations. The wizard can only detect Dialogue System-provided sample control components. You will have to manually add other components by clicking Select Player and editing the Set Enabled On Dialogue Event component.

The rest of this page describes the component types in more detail and explains how to add them manually.


Movement Controllers

The Dialogue System isn't tied to any control system, and it works with 2D and 3D projects. It provides some simple 3D movement controllers to let you quickly get a scene working. You can always swap out the control scripts later with your own.

Simple Controller

The Simple Controller is a basic third-person 3D controller that uses the legacy animation system. It allows the player to run around and optionally fire a gun.

More information: Simple Controller

Navigate On Mouse Click

The Navigate On Mouse Click controller uses a NavMesh to move the PC to where the player clicks with the mouse.

More information: Navigate On Mouse Click


Camera Controllers

The Dialogue System includes the Unity Community's Smooth Camera With Bumper script written by Daniel P. Rossi.

Smooth Follow Camera With Bumper

The Smooth Camera With Bumper follows the player, moving closer to the player as necessary if the player backs up against a wall.

More information: Smooth Camera With Bumper


Selectors

Selectors provide a way for the player to trigger interactions. Selectors are not the only way to trigger interactions, but they are a convenient method to allow the player to target an interactive NPC/object (called a "usable") and trigger it.

Selector

The Selector finds targets by raycasting from a specified source such as the current mouse position or the center of the screen. Once the player has targeted a usable, pressing a key or button will send an "OnUse" message to it. The usable can handle the "OnUse" message by starting a conversation, playing a cutscene sequence, etc.

More information: Selector

Proximity Selector

The Proximity Selector allows a player to target a usable by entering its trigger area. It works with 2D and 3D triggers. Once the player has targeted a usable, pressing a key or button will send an "OnUse" message to it. The usable can handle the "OnUse" message by starting a conversation, playing a cutscene sequence, etc.

More information: Proximity Selector


SetEnabled Controllers

When the PC is in a conversation, you will often want to prevent the player from moving or controlling the camera, especially if the conversation contains cutscene sequences that control the camera.

The Set Component Enabled On Dialogue Event component can be configured to disable player control components when a conversation starts, and then re-enable them when the conversation ends.

More information: Set Component Enabled On Dialogue Event


Modifiers

Override Actor Name

By default, conversations use the name of the PC GameObject as the PC's name. This name is used in portrait labels and is the value assigned to Variable["Actor"]. You can specify a different name by adding an Override Actor Name component.

More information: Override Actor Name

Default Camera Angle

Every actor has a default camera angle that cutscene sequences can reference. Unless specified otherwise, the angle is "Closeup". You can change the PC's angle by adding a Default Camera Angle component. For example, if the PC is a small child, you might want the default angle to be "Down" to convey that others are taller than the PC and have to look down.

More information: Default Camera Angle


Persistent Data

Persistent data components are only applicable if you use the Save System. They're described in detail in the Save System section.


Components on Child GameObjects

You can put Components On Child GameObjects.


<< Unity GUI Control System | How to Set Up NPCs >>