This page describes the built-in sequencer commands. You can also define your own commands as described on the How to Write Custom Sequencer Commands page. Third-party support packages may also add product-specific sequencer commands.
Syntax: Animation(
animation[, subject[, animations...]])
Description: Plays (cross-fades) legacy animation(s).
Parameters:
speaker
, listener
, or the name of a game object in the scene. Default: speaker
.Examples: (sequencer code)
Animation(NervousIdle)
(Plays the speaker's "NervousIdle" animation)Animation(Laugh, listener)
(Plays the listener's "Laugh" animation)Animation(RemoveHat, Sir Lancelot, Bow, ReplaceHat, Idle)
(Plays a sequence of animations. Sir Lancelot removes his hat, bows, replaces hit hat, and returns to his idle animation.)Syntax: AnimatorBool(
animatorParameter[, value[, subject]])
Description: Sets a Mecanim Boolean animator parameter.
Parameters:
true
or false
. Default: true
.speaker
, listener
, or the name of a game object in the scene. Default: speaker
.Example: (sequencer code)
AnimatorBool(Laughing, true, listener)
(Sets the "Laughing" parameter to true
on the listener's Animator)Syntax: AnimatorController(
controllerName[, subject])
Description: Sets the Mecanim runtime animator controller for a subject's Animator.
Parameters:
speaker
, listener
, or the name of a game object in the scene. Default: speaker
.Example: (sequencer code)
AnimatorController(AnimCtlrs/SwimmingController, listener)
(Makes the listener use the animator controller named "AnimCtlrs/SwimmingController" located inside a Resources folder or registered asset bundle)Syntax: AnimatorFloat(
animatorParameter[, value[, subject[, duration]])
Description: Sets a Mecanim float animator parameter.
Parameters:
true
or false
. Default: true
.speaker
, listener
, or the name of a game object in the scene. Default: speaker
.Example: (sequencer code)
AnimatorFloat(Speed, 2, speaker, 0.5)
(Increases the speaker's Speed parameter to 2.0 over 0.5 seconds)Syntax: AnimatorInt(
animatorParameter[, value[, subject]])
Description: Sets a Mecanim integer animator parameter.
Parameters:
1
.speaker
, listener
, or the name of a game object in the scene. Default: speaker
.Example: (sequencer code)
AnimatorInt(Mode, 2, Fred)
(Sets the "Mode" parameter to 2
on Fred's Animator.)Syntax: AnimatorLayer(
layerIndex[, weight[, subject[, duration]]])
Description: Sets the weight of a Mecanim animator layer.
Parameters:
1
.1
.speaker
, listener
, or the name of a game object in the scene. Default: speaker
.Example: AnimatorLayer(1, 1, speaker, 0.5)
(Sets layer 1's weight to 1.0 smoothly over 0.5 seconds)
Syntax: AnimatorTrigger(
animatorParameter[, subject])
Description: Sets a trigger parameter.
Parameters:
speaker
, listener
, or the name of a game object in the scene. Default: speaker
.Example: (sequencer code)
AnimatorTrigger(Jump, Fred)
(Sets the "Jump" trigger on Fred's Animator.)Syntax: AnimatorPlay(
stateName[, subject[, [crossfadeDuration[, layer]]])
Description: Plays an animator state. Does not wait for the state to complete.
Parameters:
speaker
, listener
, or the name of a game object in the scene. Default: speaker
.0
(play immediately)Example: (sequencer code)
AnimatorPlay(Idle, Fred)
(Plays the "Idle" state on Fred's Animator.)Syntax: AnimatorPlayWait(
stateName[, subject[, [crossfadeDuration[, layer]]])
Description: Plays an animator state. Waits for the state to complete.
Parameters:
speaker
, listener
, or the name of a game object in the scene. Default: speaker
.0
(play immediately)Example: (sequencer code)
AnimatorPlayWait(Yawn, Fred, 0.3)
(Fades over 0.3 seconds into the "Yawn" state on Fred's Animator, and waits for it to finish.)Syntax: Audio(
clip[, subject[, oneshot
]])
Description: Loads a clip from Resources or a registered asset bundle into the subject's audio source component and plays it.
Parameters:
speaker
, listener
, or the name of a game object in the scene. Default: speaker
.oneshot
: (Optional) Play the audio clip as a oneshot (i.e., calling AudioSource.PlayOneShot) without interrupting the current audio clip playing on the audio source.Notes::
Mute
that is true
, the command will not play the audio clip.Example: (sequencer code)
Audio(Hahaha, listener)
(Plays the "Hahaha" audio clip through the listener's audio source component)Syntax: AudioWait(
clip[, subject[, clips...]])
Description: Loads clip(s) from Resources into the subject's audio source component, plays it, and waits until the audio clip is done playing.
Parameters:
speaker
, listener
, or the name of a game object in the scene. Default: speaker
.Notes::
Mute
that is true
, the command will not play the audio clip.Examples: (sequencer code)
AudioWait(Hahaha, listener)
(Plays the "Hahaha" audio clip through the listener's audio source component and doesn't exit until the clip is done)AudioWait(my_mic_sound_nice, speaker, check_one, check_two, check_three)
(Plays four audio clips in order through the speaker's audio source and doesn't exit until they're all done)Syntax: AudioWWW(
clip URLs...[, subject])
Description: Retrieves audio clip(s) from URLs and plays them in sequence on the subject's audio source component, waiting until the audio clips are done playing.
Parameters:
speaker
, listener
, or the name of a game object in the scene. Default: speaker
.Notes::
Mute
that is true
, the command will not play the audio clip(s).Example: (sequencer code)
AudioWWW(http://mygame.com/hello.ogg, listener)
(Retrieves and plays "hello.ogg" on the listener's audio source component and doesn't exit until the clip is done)Syntax: Camera(
angle[, subject[, duration]])
Description: Moves the camera to a specified angle on a subject.
Parameters:
default
: Uses the default camera angle defined on the actor's GameObject. To define this angle, add a Default Camera Angle component to the GameObject. (Window > Dialogue System > Component > Supplemental > Default Camera Angle) If the GameObject doesn't have a Default Camera Angle component, it uses the angle named "Closeup".original
: Use the original pre-conversation camera position. (You should not define angles named 'default' or 'original' since they are reserved keywords.) Default: default
.speaker
, listener
, or the name of a game object in the scene. Default: speaker
.Notes:
See Also: Camera Angle Prefab, Default Camera Angles, Zoom2D()
Example: (sequencer code)
Camera(Wide Left, Adam, 3)
(Moves the camera over 3 seconds to a wide left shot of Adam)Syntax: Continue()
Description: Simulates a continue button click (i.e., moves the conversation forward).
See Also: SetContinueMode()
Example: (sequencer code)
Continue()@3
(Simulates a continue button click at the 3-second mark)Syntax: CinemachinePriority(
vcam, [priority])
Parameters:
Notes:
See Also: Cinemachine Support
Example: (sequencer code)
CinemachinePriority(specialCam)
(Sets priority of virtual camera on specialCam
to 999)Syntax: Delay(
duration)
Description: Does nothing for a specified amount of time. You can use this command to keep a sequence "playing" even if nothing else is going on.
Parameters:
Example: (sequencer code)
Delay(2.5)
(Delays 2.5 seconds)Syntax: Fade(in|out|stay
[, duration[, webcolor]])
Description: Fades the screen in or out.
Parameters:
in
or out
or stay
: Fade in or out. stay
is identical to out
except it keeps the screen faded.Notes:
stay
. This ensures that the screen stays faded out until you fade it back in.Example: (sequencer code)
Fade(out, 1, #000000)
(Fades out to black over 1 second. Equivalent to Fade(out)
.)Syntax: LiveCamera(
angle[, subject[, duration]])
Description: Moves the camera to a specified angle on a subject, tracking the subject if it moves. If you don't need to track a moving subject, you can use Camera().
Parameters:
default
: Uses the default camera angle defined on the actor's GameObject. To define this angle, add a Default Camera Angle component to the GameObject. (Window > Dialogue System > Component > Supplemental > Default Camera Angle) If the GameObject doesn't have a Default Camera Angle component, it uses the angle named "Closeup".original
: Use the original pre-conversation camera position. (You should not define angles named 'default' or 'original' since they are reserved keywords.) Default: default
.speaker
, listener
, or the name of a game object in the scene. Default: speaker
.Notes:
See Also: Camera Angle Prefab, Default Camera Angles, Zoom2D()
Example: (sequencer code)
LiveCamera(Wide Left, Adam, 3)
(Moves the camera over 3 seconds to a wide left shot of Adam, tracking Adam if he's moving)Syntax: LoadLevel(
levelName, [
spawnpoint])
Description: Loads a new level using Application.LoadLevel(). The level must have been added to your project's build settings. Before loading the new level, this command calls PersistentDataManager.Record to allow objects in the current level to record their persistent data first.
Parameters:
Actor["Player"].Spawnpoint
(see Setting Spawnpoints). Assumes the player actor in the dialogue database is named "Player".Notes:
Scripts/Supplemental/Sequencer Commands
to make it easy for you to copy and modify if you want to change the behavior.Example: (sequencer code)
LoadLevel(Shipyard)
(Loads the level named "Shipyard")LoadLevel(Shipyard,WestEntrance)
(Loads the level named "Shipyard" and places the player at WestEntrance)Syntax: LookAt([
target[, subject[, duration[, allAxes
]]]])
Description: Rotates a subject to look at a target, over a specified duration of time. Note: Frequently, you may want to make the conversants face each other when starting a conversation. To do this, add LookAt() commands to the first dialogue entry in the conversation.
If no arguments are provided, the speaker and listener immediately look at each other.
Parameters:
speaker
, listener
, or the name of a game object in the scene. Default: speaker
.allAxes
: (Optional) If specified, rotates on all axes. Otherwise keeps the subject upright.Examples: (sequencer code)
LookAt()
(Makes the speaker and listener immediately look at each other)LookAt(listener)
(Makes the speaker immediately rotate to look at the listener)LookAt(Car, Bill, 2)
(Makes Bill rotate toward Car over 2 seconds)Syntax: MoveTo(
target[, subject[, duration]])
Description: Moves a subject to the same position and rotation as a target, over a specified duration of time. If the subject has a rigidbody, this command uses Rigidbody.MovePosition/MoveRotation; otherwise it sets the transform directly.
Parameters:
speaker
, listener
, or the name of a game object in the scene. Default: speaker
.Example: (sequencer code)
MoveTo(Moonwell, Wisp, 3)
(Moves the Wisp to the Moonwell over 3 seconds)Syntax: None()
Description: A null command that does nothing.
The Dialogue System uses the Dialogue Manager's Default Sequence whenever it encounters a dialogue entry whose Sequence field is blank. If you want the dialogue entry to have no sequence, use this command.
Example: (sequencer code)
None()
Syntax: QTE(
index, duration, luaVariable, luaValue)
Description: Presents an opportunity for a Quick Time Event (QTE). The opportunity lasts for the specified duration. If the player triggers the QTE, a Lua variable is set to a specified value; otherwise it's set to a blank string.
Parameters:
0
-based index number of the QTE indicator defined in the dialogue UI. Before using this command, you should add QTE indicators to your dialogue UI, and specify the QTE input trigger buttons in the Dialogue Manager's display settings.true
or false
). Otherwise the variable will be set to the string value.Example: (sequencer code)
QTE(0, 2, Punch_NPC, yes)
This example presents a two-second QTE opportunity for the player to punch the NPC. If the player inputs the QTE trigger in time, the Lua variable Variable["Punch_NPC"]
will be set to "Yes"
. If this is in a conversation, then link to an empty child dialogue entry node whose Sequence is set to None()
, and then link from that empty node to one or more dialogue entries that check the value in their Conditions. If it's set, the entry can execute the QTE.
For more details on QTEs, see How to Add Quick Time Events (QTEs).
For a complete example, examine the "Private Hart" conversation in the Feature Demo.
Syntax: SendMessage(
methodName[, arg[, subject[, broadcast
]]])
Description: Calls GameObject.SendMessage(methodName, arg, DontRequireReceiver)
on the subject.
Parameters:
string
. This means your method should accept a string parameter.speaker
: The current speaker (default value)listener
: The current listenereveryone
: Send the message to all GameObjects in the sceneSendMessage(myMessage,,mySubject)
(Note the two commas between "myMessage" and "mySubject", indicating a blank argument for the second parameter and "mySubject" for the third parameter.)broadcast
: (Optional) If broadcast
is supplied as the fourth argument, this command will use GameObject.BroadcastMessage() to broadcast the message to the subject and all of its children. Otherwise it will use GameObject.SendMessage() to send the message only to the subject.Notes:
string
.Example: (sequencer code)
SendMessage(TakeDamage, 50, listener)
(Calls listener.SendMessage("TakeDamage", "50")
, to tell the listener to take 50 damage. The listener should have a method named TakeDamage(string damage)
)Syntax: SetActive(
gameObject[, value])
Description: Sets a game object active or inactive.
Parameters:
true
, false
, or flip
(negate the current value).Notes: This command first searches for active game objects in the scene. Failing that, it searches for inactive game objects in the scene, but the root parent of the object must be active. Failing that, it searches all loaded objects; this could find an inactive root object, but it could just as easily find a loaded prefab that isn't actually in the scene. Unfortunately Unity doesn't provide a way to distinguish between these.
Example: (sequencer code)
SetActive(Force Field, false)
(Deactivates the force field)Syntax: SetContinueMode(true|false|original)
Description: Sets the continue button mode on or off. You can use this command if you need to temporarily change the continue button mode during a dialogue entry's sequence.
Parameter:
true
: Saves the current continue button mode and sets it to Always.false
: Saves the current continue button mode and sets it to Never.original
: Restores the saved continue button mode.See Also: Continue()
Example: (sequencer code)
(Disables the continue button during the first 2 seconds of a sequence.)
Syntax: SetEnabled(
component[, value[, subject]])
Description: Enables or disables a component.
Parameters:
true
, false
, or flip
(negate the current value)speaker
, listener
, or the name of a game object in the scene. Default: speaker
.Example: (sequencer code)
SetEnabled(AttackAI, false, listener)
(Disables the "AttackAI" component on the listener to turn off the listener's attack mode)Syntax: SetPortrait(
actorName, textureName)
Description: Sets the portrait texture of a dialogue actor. Possible uses:
Parameters:
default
to use the original texture defined in the dialogue database, or pic=#
(no spaces) to use one of the actor's portrait images as defined in the database (similar to the [pic=#] tag as described in the Dialogue Markup Tags). You can also use pic=
varName if you've set Lua Variable["varName"] to a number.Notes:
Actor[
"actorName" ].Current_Portrait
that conversations look up. If it's set, this texture name is used instead of the portrait in the dialogue database. Since all Actor[] fields are saved by the Save System, this is saved, and the dialogue database is left unmodified.Examples: (sequencer code)
SetPortrait(Bob, BobAngry)
(Changes Bob's portrait to the texture "BobAngry")SetPortrait(Bob, pic=BobPicID)
(Changes Bob's portrait to the actor pic number specified by the variable BobPicID)Syntax: SetTimeout(
value)
Description: Sets the response menu timeout duration.
Parameters:
Notes: A common use for this command is to set a timeout on a specific response menu. To do this, use SetTimeout(n)
in the dialogue entry preceding the response menu. Then use SetTimeout(0)
in the dialogue entry following the response menu to disable the timer for subsequent menus.
Example: (sequencer code)
SetTimeout(5)
(Sets a 5 second timeout on response menus)Syntax: SetVariable(
variable[, value])
Description: Sets a variable to a specified value.
Parameters:
Variable[]
table.true
, false
, a number, or a string.Note::
Example: (sequencer code)
SetVariable(MyBoolVar, true)
(Sets the variable "MyBoolVar" to true)Syntax: ShowAlert(
[duration])
Description: Calls DialogueManager.ShowAlert() to show the value of Variable["Alert"]. If this command is called in a conversation, Show Alerts During Conversations must be ticked.
Parameters:
Example: (sequencer code)
ShowAlert()
Syntax: SwitchCamera(
[cameraName])
Description: Changes to a different sequencer camera. For example, you can switch to a camera with a different set of post-processing effects such as a grayscale effect or a blurry dreamlike effect. Note that you don't need to use SwitchCamera() to simply move the camera to preset shots in the scene. To do that, you can position empty GameObjects (or even inactive camera objects) and pass them as the angle parameter to the Camera() command. In addition, if you simply want to enable or disable a specific effect on the main sequencer camera, you can use the SetEnabled() command on it.
Parameters:
Example: (sequencer code)
SwitchCamera(My Sepia Camera)
(Changes to a camera named "My Sepia Camera")Syntax: TextInput(
textFieldUI, label, luaVariable[, maxLength[, clear
]])
Description: Uses a text field UI to prompt for text input.
Parameters:
var=
varName, it uses the value of the variable varName.Variable[]
table that will contain the player's input. This command starts by initializing the text field to the variable's current value. If the variable's type is Number in the dialogue database, the user's input is stored in the variable as a number; otherwise the input is stored as a text string.clear
: (Optional) If present, initializes the text field to an empty string instead of the variable's current value.Notes:
Example: (sequencer code)
TextInput(MyTextInputUI,Favorite Color,Fav_Color)
(Uses the text field UI located on the object named MyTextInputUI to display a text input prompt. The prompt's label is "Favorite Color". The user's input is stored in Variable['Fav_Color']
.)Syntax: Timeline(
mode, timeline, [nowait
], [nostop
]. [#:binding]...)
Description: Controls a Timeline (PlayableDirector).
Parameters:
play
, pause
, resume
, or stop
.nowait
: If specified, doesn't wait for the director to finish.nostop
: If specified, doesn't force the director to stop at the end of the sequencer command.nowait
and nostop
can be in either order.)Notes:
See Also: Timeline Support
Examples: (sequencer code)
Timeline(play,mySpecialTimeline)
(Plays the timeline on mySpecialTimeline
)Timeline(play,Dance,0:Player,1:Princess)
(Plays the timeline Dance
, binding track 0 to Player and track 1 to Princess)Syntax: UpdateTracker()
Description: Updates the Quest Tracker HUD.
Example: (sequencer code)
UpdateTracker()
Syntax: Voice(
audioClip, animation[, finalAnimation[, subject]])
Description: Plays audio and animation, and doesn't finish until both are done. Useful for playing a voice-acted line. (See also FaceFX() if you use FaceFX.)
Parameters:
speaker
, listener
, or the name of a game object in the scene. Default: speaker
.Notes:
Mute
that is true
, the command will not play the audio clip.Example: (sequencer code)
Voice(Bob/Hello, LipsyncHello, Idle, Bob)
(Plays the audio clip "Bob/Hello" and animation "LipsyncHello" on Bob. When both are done, plays the "Idle" animation on Bob.)Syntax: WaitForMessage(
message)
Description: Waits until another GameObject sends "OnSequencerMessage" with message as the parameter to the sequencer. The sequencer is located on the Dialogue Manager object unless you have manually created a different sequencer object elsewhere.
Parameters:
Note: Combined with the WaitForMessage() command, you can devise back-and-forth interaction with other GameObjects.
Example: (sequencer code)
SendMessage(StartDrilling,,Drill); WaitForMessage(StruckOil)
(Sends "StartDrilling" [without any arguments] to the GameObject named Drill. Then waits until it receives OnSequencerMessage("StruckOil"). For example, the Drill could execute DialogueManager.Instance.SendMessage("OnSequencerMessage", "StruckOil")
)Syntax: Zoom2D(
subject[, size[, duration]])
Description: Does a 2D orthographic camera zoom on a subject.
Parameters:
speaker
, listener
, original
, or the name of a game object in the scene. If original
, moves the camera to the original position and size before the sequencer took control of the camera. Default: speaker
.16
.Note: The Zoom2D() command works with 2D orthographic cameras. For 3D perspective cameras, use Camera().
Example: (sequencer code)
Zoom2D(Player, 8, 2)
(Zooms in to orthographicSize 8 on Player over 2 seconds)