Skip to main content

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:

  1. Add an Area Dialogue Controller component to your character.
  2. Add a Collider component to the same GameObject as the Area Dialogue Controller.
  3. Set the Collider's 'Is Trigger' value to 'true'.
  4. 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).
  5. Assign a Dialogue Asset to the 'Dialogue' field and adjust any other settings as needed.
  6. 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

SettingDescription
DialogueThe 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 TypeDetermines 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

SettingDescription
ActivatorThis 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 ModeIf 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 ModeIf 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 NameDescription
On PlayTriggered whenever dialogue playback starts.
On StopTriggered whenever dialogue playback stops.
On PromptTriggered whenever a prompt is triggered (when activation mode is set to PROMPT_ON_ENTER and the activator enters the controller's collider).
On Area EnteredTriggered whenever the activator enters the controller's collider.
On Area ExitedTriggered whenever the activator leaves the controller's collider.

Dialogue Events

Event NameDescription
On ContinueCalled whenever dialogue playback continues to the next line of dialogue, or in some cases, the next node.
On Display OptionsCalled whenever dialogue options are to be presented to the player.
On Option ChosenCalled whenever a dialogue option has been chosen/finalized.
On Display LineCalled whenever a line of dialogue is to be displayed.
On Dialogue EnteredCalled whenever dialogue playback begins.
On Dialogue ExitedCalled whenever dialogue playback ends.
On Exit CompletedCalled one frame after dialogue playback ends.
On StoryCalled whenever a story node is encountered during dialogue playback.
On Variable UpdatedCalled whenever a dialogue variable's value is changed.
On Character ChangedCalled whenever a character change is detected.
On Audio StartedCalled whenever audio playback starts for a line of dialogue.
On Audio CompletedCalled whenever audio playback stops or finishes for a line of dialogue.
On Activate KeyCalled whenever a line of dialogue is being processed.
On WaitCalled whenever a Wait node is encountered during dialogue playback.
On Conversation EndingCalled whenever dialogue playback reaches the last line of dialogue in a Conversation node.
On Node ChangedCalled whenever dialogue playback moves from one node to another.
On PauseCalled whenever a Pause node is encountered during dialogue playback.