Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Game Creator 3 logo Dialogue

Start a conversation near an NPC#

Most conversations start when the player walks up to someone. You'll move the gate conversation onto the guard, then start it when the player steps into a trigger zone around him.

Before you begin#

Complete Introduce your characters. You'll also need:

  • A game object for the guard, such as a capsule or a character model, named Guard.
  • A player game object that moves around the scene, tagged Player. It needs a Rigidbody or a Character Controller, because Unity only sends trigger messages when one is involved.

Give the guard a Dialogue component#

So far, Play Script has run the conversation on a temporary Dialogue that disappears when the conversation ends. That's enough for a scene that plays once, but the player will talk to the guard again and again. A Dialogue component on the guard keeps his conversation with him:

  • Inside the conversation, Source is the guard, so Commands and Conditions can act on him.
  • Its Local Compendium can hold entries that refer to objects in the scene.
  • It remembers which lines the player has seen and can save that memory, which later guides use to change what he says.

Set it up:

  1. Select Guard and add a Dialogue component.
  2. Drag Gate Conversation into its Script field.
  3. Select Village Gate and remove its Event component, so the conversation no longer starts on its own when the scene loads.

Add a trigger zone#

  1. Select Guard and add a Sphere Collider.
  2. Tick Is Trigger.
  3. Set Radius to 2.

The sphere marks how close the player has to be. Because it's a trigger, it detects the player without blocking movement.

Start the conversation on entry#

Add an Event component to Guard:

  1. Add an On Trigger Enter 3D Trigger.
  2. Set its Target to the Find with Tag Signal, with the tag Player. Without this filter, any object entering the sphere starts the conversation, including other NPCs.
  3. Add a Play Dialogue Instruction:
Field Value
Dialogue The Dialogue component on Guard
Skin Default (UGUI)
Await On

Play Dialogue plays the Script assigned to the component, rather than one you pick in the Instruction. With Await on, the Event keeps running until the conversation finishes. An Event doesn't start again while it's still running, so walking out of the sphere and back in during the conversation doesn't restart it. Once the conversation ends, the next entry plays it again.

The conversation knows who started it

Play Dialogue passes the Event's Target into the conversation. Inside it, Source is the game object that holds the Dialogue component, here the guard, and Target is the player who walked in.

The Commands and Conditions you'll write in later guides run with that same context, so a Command can give an item to Target and reach whoever is talking to the guard. The Visual Script manual explains Source and Target in depth.

Verify the result#

  1. Enter Play mode and walk the player toward the guard.
  2. Confirm that the conversation opens as soon as the player is within two units.
  3. Step out and back in while it's still running, and confirm that it doesn't restart.
  4. Finish the conversation, walk back in, and confirm that it plays again from the first line.

Variations#

Click to talk. Replace the Trigger with On Mouse Click, which fires when the player clicks the guard's collider. This Trigger sets Target to the clicked object, so inside the conversation Target is the guard rather than the player. A Command that needs the player should then find it another way, such as Find with Tag.

Hold the player still. Players can usually keep walking during a conversation. To stop them, add an Event with an On Dialogue Start Trigger that disables your player's movement, and another with On Dialogue Finish that enables it again.

Where to go next#

Game Creator 3 logoGame Creator 3 © Catsoft Works 2026. All rights reserved.