Page 1 of 1

Dialogue system interfacing with gameobjects

Posted: Sat Jan 04, 2020 12:39 am
by Ombra
Hi,
I recently purchased Dialogue system and am trying to familiarize myself with it. Looking over the documentation and example I am a little confused as to what the best practice is for interfacing with game objects that are already in the scene. Looking at the Events section of a dialog entry, it only takes scriptable objects/prefabs since it doesn't exist within a scene. Do I need to write a custom script/sequence to for example turn on a light in the scene or call a method on another game object?

Regards,

Ombra

Re: Dialogue system interfacing with gameobjects

Posted: Sat Jan 04, 2020 8:22 am
by Tony Li
Hi Ombra,

Thanks for buying the Dialogue System!

You're correct about the UnityEvent in dialogue entry nodes. Since the dialogue database exists outside of any particular scene, it can't reference scene objects.

Instead, the Dialogue System provides a cutscene sequence system. (More info: Cutscene Sequences Tutorials) Cutscene sequences are a series of text commands such as:

Code: Select all

SetActive(ForceField, true);
Audio(Beep)
(The sequence above activates a GameObject named "ForceField" and plays an audio clip named "Beep".) In most cases, you can drag scene objects or project assets into the dialogue entry node's Sequence field, and the editor will automatically generate the text command for you.

There are several advantages to text-based sequencer commands:

1. You can stay in the flow of writing dialogue text without having to switch mindsets into, for example, a scrubbing timeline editor. (However, the Dialogue System does support timeline editors such as Unity Timeline, SLATE, and Cinema Director; and you can even mix and match within the same conversation.)

2. You can use text substitution. For example, say you set a Dialogue System variable named "choice" to the name of a GameObject that the player has chosen in dialogue. Then you can write a command like this:

Code: Select all

SetActive([var=choice], true)
3. You can import and export your entire database to other text-based formats, such as CSV (Excel) for localization, or import from articy:draft or Chat Mapper.

---

In addition sequences, you can also use Dialogue System Trigger components. These components perform actions when a specified event occurs, such as when the player enters a trigger area or interacts with the object or when the scene starts. Since the Dialogue System Trigger is in the scene, it does offer a UnityEvent that you can hook up to scene objects. More info: Interaction Tutorial