How to Customize the Sequencer

How to Customize Sequencer Display Settings

You can customize the Sequencer's behavior through the Dialogue Manager's Display Settings:

Properties

Property Description
Sequencer Camera The sequencer camera or prefab or instantiate during sequences
Alternate Camera Object Assign this if your camera is not a Unity Camera – for example, if it's an Oculus VR camera object instead
Camera Angles The Camera Angle Prefab that contains the camera angles that the sequencer should use
Default Sequence The sequence to use when a dialogue entry doesn't have its own sequence. The keyword {{end}} is automatically replaced with the duration determined by Subtitle Chars Per Second
Disable Internal Sequencer Commands Tick to disable all internally-handled sequencer commands defined in Sequencer.cs

How to Write Custom Sequencer Commands

To create your own sequence commands:

  1. Copy the template in Scripts/Templates/SequencerCommandTemplate.cs.
  2. Delete the lines containing the text [REMOVE THIS LINE].
  3. Rename the class from SequencerCommandTemplate to SequencerCommandFoo, where Foo is the name of your command. In your sequences, you'll use the command Foo().
  4. Add your code to the Start(), Update(), and/or OnDestroy() methods:
Method Description
Start() Initialize the command. You can use GetParameter() to read the parameters that were provided to the command
Update() (Optional) Progress the command forward one frame. For example, if the command smoothly moves an object over time, update the transform by Time.deltaTime
OnDestroy() (Optional) "Clean up" the command. For example, move the object to its final position

In Start() and/or Update(), whichever is appropriate, call Stop() to indicate that the command is done. Otherwise the command will remain active forever, and the sequence will never register as finished.

To see examples, you can browse the source code to the built-in commands in
Scripts/Core/Model-View-Controller/View/Sequencer/SequencerCommands.

Example: LoadLevel()

This sequencer command loads a new level.

  • Syntax: LoadLevel(My Level Name)
  • Description: Loads the level named "My Level Name".
  • Notes: You must add the scene named "My Level Name" to your build settings.

SequencerCommandLoadLevel.cs

using UnityEngine;
 
public class SequencerCommandLoadLevel : SequencerCommand {
 
public void Start() {
string levelName = GetParameter(0);
if (!string.IsNullOrEmpty(levelName)) {
PersistentDataManager.Record(); // Let current persistent objects save themselves.
Application.LoadLevel(levelName);
}
Stop();
}
}

Note that a version of this script is now included in the Dialogue System itself. The code remains here as an example.


<< How to Add Quick Time Events (QTEs) | Localization >>

PixelCrushers.DialogueSystem
Definition: ArticyConverterWindow.cs:8
PixelCrushers
Definition: ArticyConverterWindow.cs:8
NLua.GCOptions.Stop
Stops the garbage collector.