Area Dialogue Controllers
An Area Dialogue Controller component can be used instead of a regualar Dialogue Controller to automatically start and stop dialogue playback whenever an object enters the area defined by a trigger collider on the controller.
Setup
To set up an Area Dialogue Controller, do the following:
- Add an Area Dialogue Controller component to your character.
- Add a Collider component to the same GameObject as the Area Dialogue Controller.
- Set the Collider's 'Is Trigger' value to 'true'.
- In the Dialogue Controller's 'Activator' field, assign the collider which you want to trigger dialogue playback (Note: this should be a different collider, such as a collider for a player character).
- Assign a Dialogue Asset to the 'Dialogue' field and adjust any other settings as needed.
- To have dialogue play automatically whenever the Activator collider enters the trigger collider, set the Activation Mode to PLAY_ON_ENTER. If you would rather activate some other script or prompt object first, set the Activation Mode to PROMPT_ON_ENTER instead, and you can add events to the 'On Prompt' or 'On Area Entered' events to handle any logic of your own, and call PlayDialogue() yourself.
Area Controller Settings
Area Dialogue Controller Settings
General Settings
Setting | Description |
---|---|
Dialogue | The Dialogue Asset containing the dialogue or logic which the controller will use. |
Dialogue Registry | (Optional) A Dialogue Registry to use for initializing global variables. Normally the Dialogue Registry is used from Dialogue Settings (set on a Dialogue Display), but if there is no Dialogue Display being used, this can be set to allow global variables to be used with controllers. |
Playback Type | Determines how dialogue should be played on the controller, either waiting for player input to continue to the next line of dialogue, or automatically proceeding based on a timer (or the length of audio for a line). |
Dialogue Display | (Optional) Tells the controller which dialogue display it should use when PlayDialogue() is called. If this isn't set, it will search for one in the scene. |
Conversation Display | (Optional) The conversation display to use for displaying dialogue for this controller. If left empty, the Dialogue Display will use its currently set conversation display. |
Audio Source | (Optional) The audio source to use when playing audio for lines of dialogue. If left empty, the Dialogue Display will attempt to use an audio source of its own instead. |
Activation Settings
Setting | Description |
---|---|
Activator | This is the collider which will activate the controller to start dialogue playback or trigger a prompt. |
Entry Point | (Optional) Specifies the Entry node ID where dialogue playback should start. |
Activation Mode | If this is set to PLAY_ON_ENTER, the controller will automatically start dialogue playback whenever the 'activator collider' enters the collider of this controller. If set to PROMPT_ON_ENTER, the controller will not play dialogue automatically, but instead will trigger anything registered with the 'On Prompt' Unity event. |
Deactivation Mode | If set to FINISH_PLAYING, then the dialogue will conttinue playback even after the 'activator collider' leaves the controller's collider. If this is EXIT_ON_LEAVE_AREA, dialogue playback will exit immediately whenever the 'activator collider' is no longer colliding with the controller's collider. |
Dialogue Listeners
Dialogue Listeners can be added to this list and their relevant methods will be called as events take place during dialogue playback. By creating your own Dialogue Listener extension class you can create more complex systems which respond to dialogue events.
Controller Events
Event Name | Description |
---|---|
On Play | Triggered whenever dialogue playback starts. |
On Stop | Triggered whenever dialogue playback stops. |
On Prompt | Triggered whenever a prompt is triggered (when activation mode is set to PROMPT_ON_ENTER and the activator enters the controller's collider). |
On Area Entered | Triggered whenever the activator enters the controller's collider. |
On Area Exited | Triggered whenever the activator leaves the controller's collider. |
Dialogue Events
Event Name | Description |
---|---|
On Continue | Called whenever dialogue playback continues to the next line of dialogue, or in some cases, the next node. |
On Display Options | Called whenever dialogue options are to be presented to the player. |
On Option Chosen | Called whenever a dialogue option has been chosen/finalized. |
On Display Line | Called whenever a line of dialogue is to be displayed. |
On Dialogue Entered | Called whenever dialogue playback begins. |
On Dialogue Exited | Called whenever dialogue playback ends. |
On Exit Completed | Called one frame after dialogue playback ends. |
On Story | Called whenever a story node is encountered during dialogue playback. |
On Variable Updated | Called whenever a dialogue variable's value is changed. |
On Character Changed | Called whenever a character change is detected. |
On Audio Started | Called whenever audio playback starts for a line of dialogue. |
On Audio Completed | Called whenever audio playback stops or finishes for a line of dialogue. |
On Activate Key | Called whenever a line of dialogue is being processed. |
On Wait | Called whenever a Wait node is encountered during dialogue playback. |
On Conversation Ending | Called whenever dialogue playback reaches the last line of dialogue in a Conversation node. |
On Node Changed | Called whenever dialogue playback moves from one node to another. |
On Pause | Called whenever a Pause node is encountered during dialogue playback. |