Sequencer Command Reference

This page describes the built-in sequencer commands. You can also define your own commands as described on the Custom Sequencer Commands page. Third-party support packages may also add product-specific sequencer commands.

Built-In Command List


Animation()

Syntax: Animation(animation[, subject[, animations...]])

Description: Plays (cross-fades) legacy animation(s).

Parameters:

  • animation: The name of a legacy animation in the subject Animation component.
  • subject: (Optional) The object that will play the animation. Can be speaker, listener, or the name of a game object in the scene. Default: speaker.
  • animations...: (Optional) Any number of legacy animations to play in sequence when the first animation is done. Usually the last animation returns to idle.

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.)

AnimatorBool()

Syntax: AnimatorBool(animatorParameter[, value[, subject]])

Description: Sets a Mecanim Boolean animator parameter.

Parameters:

  • animatorParameter: The name of a Boolean parameter in a Mecanim Animator.
  • value: (Optional) Can be true or false. Default: true.
  • subject: (Optional) The object with the Animator component. Can be 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)

AnimatorController()

Syntax: AnimatorController(controllerName[, subject])

Description: Sets the Mecanim runtime animator controller for a subject's Animator.

Parameters:

  • controllerName: The path to an animator controller that can be loaded from a Resources folder or registered asset bundle.
  • subject: (Optional) The object with the Animator component. Can be 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)

AnimatorFloat()

Syntax: AnimatorFloat(animatorParameter[, value[, subject[, duration]])

Description: Sets a Mecanim float animator parameter.

Parameters:

  • animatorParameter: The name of a float parameter in a Mecanim Animator.
  • value: (Optional) Can be true or false. Default: true.
  • subject: (Optional) The object with the Animator component. Can be speaker, listener, or the name of a game object in the scene. Default: speaker.
  • duration: (Optional) The duration in seconds to smoothly change to the value. If omitted, the value is set immediately.

Example: (sequencer code)

  • AnimatorFloat(Speed, 2, speaker, 0.5) (Increases the speaker's Speed parameter to 2.0 over 0.5 seconds)

AnimatorInt()

Syntax: AnimatorInt(animatorParameter[, value[, subject]])

Description: Sets a Mecanim integer animator parameter.

Parameters:

  • animatorParameter: The name of an integer parameter in a Mecanim Animator.
  • value: (Optional) Integer value. Default: 1.
  • subject: (Optional) The object with the Animator component. Can be 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.)

AnimatorLayer()

Syntax: AnimatorLayer(layerIndex[, weight[, subject[, duration]]])

Description: Sets the weight of a Mecanim animator layer.

Parameters:

  • layerIndex: The layer index. Default: 1.
  • weight: (Optional) The new weight. Default: 1.
  • subject: (Optional) The object with the Animator component. Can be 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)


AnimatorTrigger()

Syntax: AnimatorTrigger(animatorParameter[, subject])

Description: Sets a trigger parameter.

Parameters:

  • animatorParameter: The name of an integer parameter in a Mecanim Animator.
  • subject: (Optional) The object with the Animator component. Can be 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.)

AnimatorPlay()

Syntax: AnimatorPlay(stateName[, subject[, [crossfadeDuration[, layer]]])

Description: Plays an animator state. Does not wait for the state to complete.

Parameters:

  • stateName: The name of a state in a Mecanim Animator.
  • subject: (Optional) The object with the Animator component. Can be speaker, listener, or the name of a game object in the scene. Default: speaker.
  • crossfadeDuration: (Optional) The duration to crossfade into the state. Default: 0 (play immediately)
  • layer: (Optional) The layer containing the state. Default: -1 (any layer)

Example: (sequencer code)

  • AnimatorPlay(Idle, Fred) (Plays the "Idle" state on Fred's Animator.)

AnimatorPlayWait()

Syntax: AnimatorPlayWait(stateName[, subject[, [crossfadeDuration[, layer]]])

Description: Plays an animator state. Waits for the state to complete.

Parameters:

  • stateName: The name of a state in a Mecanim Animator.
  • subject: (Optional) The object with the Animator component. Can be speaker, listener, or the name of a game object in the scene. Default: speaker.
  • crossfadeDuration: (Optional) The duration to crossfade into the state. Default: 0 (play immediately)
  • layer: (Optional) The layer containing the state. Default: -1 (any layer)

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.)

Audio()

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:

  • clip: The path to an audio clip inside a Resources folder or a registered asset bundle.
  • subject: (Optional) The object that will play the animation. Can be 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::

  • This command exits immediately. If you want to wait until the clip is done, use AudioWait().
  • If the subject is null, this command uses the audio source on the Dialogue Manager object, adding an audio source component if necessary.
  • If the Lua environment has a Boolean variable named Mute that is true, the command will not play the audio clip.
  • If you notice a steeper than desired dropoff in volume with 3D sounds, adjust the audio source's dropoff curve.

Example: (sequencer code)

  • Audio(Hahaha, listener) (Plays the "Hahaha" audio clip through the listener's audio source component)

AudioWait()

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:

  • clip: The path to an audio clip inside a Resources folder or registered asset bundle.
  • subject: (Optional) The object that will play the animation. Can be speaker, listener, or the name of a game object in the scene. Default: speaker.
  • clips: (Optional) Additional clips to play in order.

Notes::

  • This command waits until the clip is done. If you want to exit immediately, use Audio().
  • If the subject is null, this command uses the audio source on the Dialogue Manager object, adding an audio source component if necessary.
  • If the Lua environment has a Boolean variable named Mute that is true, the command will not play the audio clip.
  • If you notice a steeper than desired dropoff in volume with 3D sounds, adjust the audio source's dropoff curve.

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)

AudioWWW()

Note: The AudioWWW() command has been deprecated and is no longer available in version 2.0.5+.

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:

  • clip...: The URLs to an audio clips. Note: Unity only loads OGG files from URLs, so your audio clips must be in .ogg format.
  • subject: (Optional) The object that will play the animation. Can be speaker, listener, or the name of a game object in the scene. Default: speaker.

Notes::

  • If the subject is null, this command uses the audio source on the Dialogue Manager object, adding an audio source component if necessary.
  • If the Lua environment has a Boolean variable named Mute that is true, the command will not play the audio clip(s).
  • If you notice a steeper than desired dropoff in volume with 3D sounds, adjust the audio source's dropoff curve.

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)

Camera()

Syntax: Camera(angle[, subject[, duration]])

Description: Moves the camera to a specified angle on a subject.

Parameters:

  • angle: The name of a camera angle (child transform) defined in the sequencer's camera angle object. If the angle isn't defined in the camera angle object, this command looks for a game object in the scene and moves the camera to that game object's transform. These special keywords are also available:
    • 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.
  • subject: (Optional) The transform to focus on. Can be speaker, listener, or the name of a game object in the scene. Default: speaker.
  • duration: (Optional) Smoothly move the camera over this many seconds. If omitted, cut immediately.

Notes:

  • The Camera() command works with 3D perspective cameras. For 2D orthographic cameras, use Zoom2D().
  • This command determines the target position at its start and does not track the subject if it moves. To track the subject over the duration of the command, use LiveCamera().

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)

Continue()

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)

CinemachinePriority()

Syntax: CinemachinePriority(vcam, [priority])

Parameters:

  • vcam: The name of a GameObject containing a CinemachineVirtualCamera.
  • priority: (Optional) New priority level. Default: 999.

Notes:

  • Support for Cinemachine in Unity 2017+ is built into the Dialogue System.

See Also: Timeline & Cinemachine

Example: (sequencer code)

  • CinemachinePriority(specialCam) (Sets priority of virtual camera on specialCam to 999)

Delay()

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:

  • duration: The seconds to delay.

Example: (sequencer code)

  • Delay(2.5) (Delays 2.5 seconds)

Fade()

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.
  • duration: (Optional) The number of seconds over which to fade. Default: 1.
  • webcolor: (Optional) A color in the format #rrggbb to fade to/from. Default: Black.

Notes:

  • To fade out, do some "behind the scenes" work such as changing scenes, and then fade in, use stay. This ensures that the screen stays faded out until you fade it back in.
  • Fade() uses a Unity UI Screen Space Overlay canvas with a Sort Order of 32766. This will cover all other canvases except Screen Space Overlay canvases with a Sort Order of the maximum value, 32767.
  • Since Fade() uses a Screen Space Overlay canvas, it doesn't support VR. If you're using VR, you may want to write your own variation of Fade() or use a different fader such as that found in Unity's VR Samples package.

Example: (sequencer code)

  • Fade(out, 1, #000000) (Fades out to black over 1 second. Equivalent to Fade(out).)

LiveCamera()

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:

  • angle: The name of a camera angle (child transform) defined in the sequencer's camera angle object. If the angle isn't defined in the camera angle object, this command looks for a game object in the scene and moves the camera to that game object's transform. These special keywords are also available:
    • 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.
  • subject: (Optional) The transform to focus on and follow over the duration of the command. Can be speaker, listener, or the name of a game object in the scene. Default: speaker.
  • duration: (Optional) Smoothly move the camera over this many seconds. If omitted, cut immediately.

Notes:

  • The Camera() and LiveCamera() commands work with 3D perspective cameras. For 2D orthographic cameras, use Zoom2D().
  • This sequencer command was written and donated by Patricio Jeri.

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)

LoadLevel()

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:

  • levelName: The name of the level to load.
  • spawnpoint: Optional player spawnpoint in the destination level. If specified, sets Actor["Player"].Spawnpoint or tells the Save System to spawn the player at the spawnpoint.

Example: (sequencer code)

  • LoadLevel(Shipyard) (Loads the level named "Shipyard")
  • LoadLevel(Shipyard,WestEntrance) (Loads the level named "Shipyard" and places the player at WestEntrance)

LookAt()

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:

  • target: (Optional) The transform to look at.
  • subject: (Optional) The object to rotate. Can be speaker, listener, or the name of a game object in the scene. Default: speaker.
  • duration: (Optional) The number of seconds over which to smoothly rotate. If omitted, the subject rotates immediately.
  • 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)

MoveTo()

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:

  • target: The transform to move to.
  • subject: (Optional) The object to move. Can be speaker, listener, or the name of a game object in the scene. Default: speaker.
  • duration: (Optional) The number of seconds over which to smoothly move the subject. If omitted, the subject moves immediately.

Example: (sequencer code)

  • MoveTo(Moonwell, Wisp, 3) (Moves the Wisp to the Moonwell over 3 seconds)

None()

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()

QTE()

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:

  • index: The 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.
  • duration: The duration in seconds to display the QTE indicator. If the duration elapses without the player triggering the QTE, the indicator disappears and the QTE can't be triggered.
  • luaVariable: Lua variable to set if the player triggers the QTE.
  • luaValue: Lua value to set the variable to if the QTE is triggered. If not triggered, the variable is set to a blank string. If the value is 'true' or 'false', the variable will be set to the Boolean value (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 Quick Time Events.


SendMessage()

Syntax: SendMessage(methodName[, arg[, subject[, broadcast]]])

Description: Calls GameObject.SendMessage(methodName, arg, DontRequireReceiver) on the subject.

Parameters:

  • methodName: The message to send.
  • arg: (Optional) An argument to pass with the message. NOTE: This argument is always passed as a string. This means your method should accept a string parameter.
  • subject: (Optional) The object to send the message to. Can be:
    • speaker: The current speaker (default value)
    • listener: The current listener
    • everyone: Send the message to all GameObjects in the scene
    • Or the name of a game object in the scene. (NOTE: If you specify a speaker, make sure it's the third parameter. If you're not passing an argument with the message, leave the second parameter blank, like this: SendMessage(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:

  • This is a versatile, general-purpose command. You can communicate with any other GameObject (or all GameObjects) in the scene. Combined with the WaitForMessage() command, you can devise back-and-forth communication.
  • Remember that, if you specify an argument, it will be passed as a 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))

SetActive()

Syntax: SetActive(gameObject[, value])

Description: Sets a game object active or inactive.

Parameters:

  • gameObject: The game object to set, which cannot be speaker or listener, since they're involved in the conversation.
  • value: (Optional) 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.
  • If gameObject starts with 'tag=', it specifies a tag instead of a GameObject name. You can only use this to deactivate GameObjects, not activate them. All GameObjects with this tag will be deactivated.

Example: (sequencer code)

  • SetActive(Force Field, false) (Deactivates the force field)
  • SetActive(tag=Enemy, false) (Deactivates all GameObjects tagged Enemy)

SetContinueMode()

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:

  • The parameter can be:
    • 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)

SetContinueMode(false);
Animation(uninterruptibleDance);
SetContinueMode(true)@2

(Disables the continue button during the first 2 seconds of a sequence.)


SetEnabled()

Syntax: SetEnabled(component[, value[, subject]])

Description: Enables or disables a component.

Parameters:

  • component: The name of a component on the subject.
  • value: (Optional) true, false, or flip (negate the current value)
  • subject: (Optional) The subject that owns the component. Can be speaker, listener, or the name of a game object in the scene. Default: speaker.

Notes:

  • If subject starts with 'tag=', it specifies a tag instead of a GameObject name. All GameObjects with this tag will have their components changed.

Example: (sequencer code)

  • SetEnabled(AttackAI, false, listener) (Disables the "AttackAI" component on the listener to turn off the listener's attack mode)
  • SetEnabled(AttackAI, true, tag=Enemy) (Enables AttackAI on all GameObjects tagged Enemy)

SetPanel()

Syntax: SetPanel(actorName, panelID)

Description: Changes a dialogue actor's subtitle panel number. If a conversation is active, takes effect in the actor's next line.

Parameters:

  • actorName: The name of the dialogue actor. It must have a Dialogue Actor component. Default: speaker.
  • panelID: A subtitle panel number or 'default' for the default panel or 'bark' to use the actor's bark UI.

Examples: (sequencer code)

  • SetPanel(Bob, 2) (Changes Bob's subtitle panel to panel 2)

SetPortrait()

Syntax: SetPortrait(actorName, textureName)

Description: Sets the portrait texture of a dialogue actor. Possible uses:

  • If the actor becomes angry, change the portrait to an angry expression
  • If you've written a conversation with a generic "Vendor" actor, you can set the portrait of the actual actor that the player is conversing with.

Parameters:

  • actorName: The name of the actor in the dialogue database.
  • textureName: The path to a texture inside a Resources folder or registered asset bundle, or 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 Markup Tags). You can also use pic=varName if you've set Lua Variable["varName"] to a number.

Notes:

  • The actor continues to use the new portrait until you change it back.
  • As of version 1.2.4, this command takes visual effect immediately instead of waiting until the next subtitle.
  • Prior to version 1.1.9, this command set the portrait in the dialogue database. It now sets a field 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)

SetTimeout()

Syntax: SetTimeout(value)

Description: Sets the response menu timeout duration.

Parameters:

  • value: The response menu timeout duration. Use 0 (zero) to disable the timer.

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)

SetVariable()

Syntax: SetVariable(variable[, value])

Description: Sets a variable to a specified value.

Parameters:

  • variable: The name of the variable to set. This should be in the Dialogue System's Variable[] table.
  • value: true, false, a number, or a string.

Note::

  • Be careful with string values. The sequencer uses a very simplified syntax that doesn't use quotes around strings. If your string value has a comma, the sequencer will interpret it as a separator between the value and a third (unused) parameter. If your string value has an end parenthesis, the sequencer will assume it indicates the end of the command.

Example: (sequencer code)

  • SetVariable(MyBoolVar, true) (Sets the variable "MyBoolVar" to true)

ShowAlert()

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:

  • duration: The duration in seconds to show the alert (defaults to the Dialogue Manager's value).

Example: (sequencer code)

  • ShowAlert()

SwitchCamera()

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:

  • cameraName: The name of a camera prefab or object in the scene. If the object is in the scene, it may be deactivated but in this case it must be a child of an active object.

Example: (sequencer code)

  • SwitchCamera(My Sepia Camera) (Changes to a camera named "My Sepia Camera")

TextInput()

Syntax: TextInput(textFieldUI, label, luaVariable[, maxLength[, clear]])

Description: Uses a text field UI to prompt for text input.

Parameters:

  • textFieldUI: The name of a GameObject containing a text field UI (i.e., an implementation of ITextFieldUI such as StandardUIInputField). This GameObject must be active in the scene, although its child controls (such as the label, text field, etc.) may be inactive.
  • label: A label for the text field. Leave blank if you don't want to use a label. If the label starts with var=varName, it uses the value of the variable varName.
  • luaVariable: The name of the Lua entry in the 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.
  • maxLength: (Optional) The maximum number of characters the player can enter.
  • clear: (Optional) If present, initializes the text field to an empty string instead of the variable's current value.

Notes:

  • If you want to restrict text to specific characters using a Unity UI Text Field, set the InputField's Content Type dropdown – for example, set it to Integer Number to allow only integer input.

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'].)

Timeline()

Syntax: Timeline(mode, timeline, [nowait], [nostop]. [#:binding]...)

Description: Controls a Timeline (PlayableDirector).

Parameters:

  • mode: Can be play, pause, resume, or stop.
  • timeline: Name of a GameObject with a PlayableDirector. Default: speaker.
  • 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.)
  • #:binding: If specified, the number indicates the track number (0, 1, 2,...). The binding is the name of a GameObject to bind to that track.

Notes:

  • Support for Playables and Timeline in Unnity 2017+ is built into the Dialogue System.

See Also: Timeline & Cinemachine

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)

UpdateTracker()

Syntax: UpdateTracker()

Description: Updates the quest tracker HUD (see Quests).

Example: (sequencer code)

  • UpdateTracker()

Voice()

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 Lipsync for other lipsync options.)

Parameters:

  • audioClip: The path to an audio clip inside a Resources folder or registered asset bundle.
  • animation: The name of a legacy animation in the subject Animation component.
  • finalAnimation: (Optional) The name of a legacy animation to play when the animation is done. If omitted, the NPC returns to the default clip defined on the Animation component (i.e., the one that gets played when Play Automatically is ticked).
  • subject: (Optional) The object that will play the animation. Can be speaker, listener, or the name of a game object in the scene. Default: speaker.

Notes:

  • Note the order of arguments, which is different from Animation(). The ability to have shorter Voice() commands was chosen over consistency with the Animation() command.
  • If the Lua environment has a Boolean variable named 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.)

WaitForMessage()

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:

  • message: The message to wait for.

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"))

Zoom2D()

Syntax: Zoom2D(subject[, size[, duration]])

Description: Does a 2D orthographic camera zoom on a subject.

Parameters:

  • subject: (Optional) The transform to focus on. Can be 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.
  • size: (Optional) The orthographicSize to zoom to. Default: 16.
  • duration: (Optional) Smoothly move the camera over this many seconds. If omitted, cut immediately.

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)

<< Cutscene Sequences