Skip to main content

Setting Up Dialogue in a Scenario

Typewriter requires setup in two places: the Unity Editor and the scene. This guide covers the scene side: adding the components that let the Sequencer play back your dialogue at runtime. For authoring the dialogue content itself, see Creating Dialogue Entries.

Before any dialogue can play, your scene must have all four of these:

  • TypewriterSequencer — one instance on a scene-manager GameObject. This is the dialogue engine; without it, nothing routes or plays.
  • TypewriterActor (one per character) — add to every character or ego agent that speaks or receives messages.
  • Response component(s) — one per message type on each Actor. Tells the Actor how to display each message type in the UI.
  • Event source — something that fires events at the right moment: a trigger zone, a Timeline marker, or a component callback.

The Sequencer​

  1. Create (or select) a scene-manager GameObject.
  2. Add the TypewriterSequencer component.

The TypewriterSequencer component in the Unity Inspector, with the Allow Multi Entry Playing checkbox visible

Typewriter Sequencer
Field
Description
Allow Multi Entry Playing
On (default): multiple entries play simultaneously (for example, two actors speak in parallel). Off: entries queue and play one at a time. Turn it off for scripted back-and-forth conversations.

The Actor​

  1. Select the character's root GameObject.
  2. Add the TypewriterActor component.
  3. Click the Actor field picker and select the matching Actor entry from the database.

TypewriterActor component in the Inspector with the Actor field assigned to an actor entry from the database

note

Disabling the character's GameObject automatically silences the character. It does not send or receive any dialogue while disabled.

Response Components​

A Response component is a component that tells an Actor how to display a specific message type in the UI. Add one for each message type that the Actor should handle. Response components must be on the same GameObject as the TypewriterActor. Adding a Response component also adds a TypewriterActor automatically if one is missing.

Component: DialogueMsgResponse

DialogueMsgResponse component in the Inspector with all prefab slots filled in

Dialogue Msg Response
Field
Description
Message Panel
The message list UI on the phone canvas.
Owned Dialogue Prefab
Messages sent by this actor. Use Dialogue Msg Element Owned.
Received Dialogue Prefab
Messages received from others. Use Dialogue Msg Element Received.
Owned Thought Prefab
Thought bubbles from this actor. Use Thought Msg Element Owned.
Received Thought Prefab
Thoughts received from others. Use Thought Msg Element Received.

All four prefabs are in Assets/mobisim/Dialogue/Prefab/.

Firing Events​

An event source fires a dialogue event at the right moment. There are three ways to fire events. Choose the one that suits your scenario:

Best for: testing and simple triggers.

A component whose TriggerEvent() method fires an Event entry. You can call it from the Inspector or from another component.

  1. Add the TypewriterEventHandle component to any GameObject.
  2. In the Event field, select the Event entry to trigger.
  3. Use the Trigger Event button in the Inspector during Play mode to test, or connect its TriggerEvent() method to another component's Unity Event field.