Databrain Documentation
databrain.ccDiscord
  • Welcome
  • Installation / Update
  • Interface
  • DataObject Property Drawer
    • No GUI Implemented - FIX
  • Getting started
  • Guides
    • Add data objects
    • Add data objects at runtime
    • Get initial data
    • Get/Set runtime data
    • Serialize DataObjects
    • Runtime Save & Load
    • Use custom serializer
    • Import
    • Search
    • Custom GUI
    • Custom GUI with Odin Inspector
    • Hierarchy Template
  • Separate DataObjects
  • Using Version Control
  • Attributes
    • DataObject attributes
    • Field attributes
  • API
    • DataLibrary
    • DataObject
  • FAQ
    • Databrain - FAQ
  • Add-ons
    • Events
    • Blackboard
    • Logic
      • Interface
      • Create Graph
      • Execute graph
      • Control flow execution in groups
      • Custom Nodes
        • Asynchronous execution
        • Node Attributes
      • Scene Components
      • Graph Events
      • Finite State Machine
        • Create custom Actions
        • Examples
        • State Machine Nodes
    • Stats
      • Achievements
      • Modifiers
      • Values
      • Progressions
      • Components
      • Nodes
    • Progress
      • Progress Settings
      • Progress Graph
      • Progress Resources
      • Runtime UI Setup
      • API
        • ProgressController
    • Techtree (LEGACY)
      • Techtree Manager
      • Techtree
      • TechtreeResource
      • Techtree UIBuilder
        • Custom Techtree Node Button
        • Tooltip
      • API
    • Localization
      • Localization Manager
      • Localization
      • Examples
      • Components
      • Import
      • API
    • Inventory
      • Getting started
      • Demo
      • Data setup
        • Inventories
        • Slot IDs
        • Items
          • Blueprints
          • Item rarities
        • Money
        • Loot tables
        • Events
      • Runtime UI
        • Setup
    • Dialogue
      • Getting Started
        • Demo
      • Dialogue runtime setup
      • Actors
        • Emotions
      • Localization
      • Audio
      • Animation
      • Variables
      • Custom theme
      • Import
      • Nodes
      • API
        • DialogueController
        • IDialogueUIControl
  • Changelog
    • Databrain - Changelog
      • 1.4.0
      • 1.3.2
      • 1.3.1
      • 1.3.0
      • 1.2.0
      • 1.1.0
      • 1.0.10
      • 1.0.9
      • 1.0.8
      • 1.0.7
      • <= 1.0.6
Powered by GitBook
On this page
  • Scene Setup
  • Start a Dialogue
  1. Add-ons
  2. Dialogue

Dialogue runtime setup

PreviousDemoNextActors

Last updated 8 months ago

Scene Setup

Follow these steps for the runtime scene setup.

  1. Create an empty GameObject in your scene and call it DialogueController.

  2. Add the DialogueController component to it.

  1. On the DialogueController, assign the DataLibrary in which your dialogue has been created.

  2. Select the dialogue graph from the dropdown.

  3. Now you'll need to assign a dialogue theme. You can find three ready to use themes in the folder: Dialogue / Themes Drag a theme prefab inside of a Canvas GameObject in the scene, then assign it to the DialogueController component.

  4. Set a language - if you have defined some in your dialogue graph.

  5. If you have any audio clips in your dialogue you'll have to assign the audio sources in the audiosources list. You can read more about the audio setup here ->

Start a Dialogue

All relevant API methods are inside of the DialogueController component. If you want to start a dialogue simply call:

dialogueController.StartDialogue();

Here's a simple script which will start a dialogue on press of an IMGUI button:

using UnityEngine;
using Databrain.Dialogue;

public class StartDialogue : MonoBehaviour
{
    // Reference to the dialogue controller
    public DialogueController dialogueController;
    
    public void OnGUI()
    {
        if (GUILayout.Button("Start Dialogue"))
        {
            dialogueController.StartDialogue();
        }
    }
}

By calling the StartDialogue method, the assigned dialogue theme which has the IDialogueUIControl interface implemented will receive a call on the OnDialogueStart method.

Your scene hierarchy should look similar to this