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) Float 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.
  • 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[, resetParameter]])

Description: Sets a trigger parameter. Optionally resets another trigger parameter.

Parameters:

  • animatorParameter: The name of a trigger 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.
  • resetParameter: (Optional) The name of another trigger parameter to reset.

Example: (sequencer code)

  • AnimatorTrigger(Jump, Fred) (Sets the "Jump" trigger on Fred's Animator.)
  • AnimatorTrigger(Idle, , Talk) (Sets the "Idle" parameter on the speaker and resets (clears) the "Talk" parameter.)

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)
  • noactivate: (Optional) Optional parameter to prevent activation of inactive subjects.

Notes:

  • If the subject GameObject is inactive, this command will activate it unless you pass noactivate.

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 registered asset bundle, or an addressable asset.
  • subject: (Optional) The object that will play the audio. 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 specified audio clip doesn't exist, this command will not report a warning unless you set the static property Sequencer.reportMissingAudioFiles true.
  • 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 subject has a Dialogue Actor component, you can assign the audio source to use to the Dialogue Actor.
  • 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)

AudioStop()

Syntax: AudioStop([subject])

Description: Stops a subject's Audio Source.

Parameters:

  • subject: (Optional) The object whose Audio Source to stop. Can be speaker, listener, or the name of a game object in the scene. Default: speaker.

Notes::

  • If the subject has a Dialogue Actor component, you can assign the audio source to use to the Dialogue Actor.
  • If you use the oneshot option with Audio(), this command cannot stop the audio.

Example: (sequencer code)

  • AudioStop(listener) (Stops 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, or an addressable asset.
  • 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 specified audio clip doesn't exist, this command will not report a warning unless you set the static property Sequencer.reportMissingAudioFiles true.
  • 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 subject has a Dialogue Actor component, you can assign the audio source to use to the Dialogue Actor.
  • 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)

AudioWaitOnce()

Syntax: AudioWaitOnce(clip[, subject[, clips...]])

Description: This command works like AudioWait() except it will check for an internal Lua variable of the entrytag/audioclip name, and if it exists/is true, the audio will be skipped. After one playback, the variable will be created and marked as true.


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)

ClearSubtitleText()

Syntax: ClearSubtitleText(panel#|all)

Description: Clears the text of a Standard Dialogue UI subtitle panel (or all panels).

Parameters:

  • panel#|all: Specify a panel to clear or all to clear all panels.

Example: (sequencer code)

  • ClearSubtitleText(all) (Clears all subtitle text)

Continue([all])

Syntax: Continue([all])

Description: Simulates a continue button click (i.e., moves the conversation forward). If passed all, continues all active conversations. Otherwise only continues conversation that called this command.

See Also: SetContinueMode()

Notes::

  • If the dialogue entry's Sequence is None() or Continue(), the conversation will not display its subtitle.
  • Never use the keyword required in front of the Continue() sequencer command.

Example: (sequencer code)

  • Continue()@3 (Simulates a continue button click at the 3-second mark)

CinemachinePriority()

Syntax: CinemachinePriority(vcam, [priority], [cut])

Parameters:

  • vcam: The name of a GameObject containing a CinemachineVirtualCamera. Alternatives for this parameter:
    • all: Set the priority of all vcams.
    • except:GameObject: Set the priority of all vcams except the one named GameObject.
  • priority: (Optional) New priority level. Default: 999.
  • cut: (Optional) Cuts immediately to the new vcam instead of easing to it.

Notes:

  • To enable support for Cinemachine, use the Welcome Window.

See Also: Timeline & Cinemachine

Examples: (sequencer code)

  • CinemachinePriority(specialCam) (Sets priority of virtual camera on specialCam to 999)
  • CinemachinePriority(all, 0) (Sets priority of all virtual cameras to 0)

CinemachineTarget()

Syntax: CinemachineTarget(vcam, [target], [look|follow|both])

Parameters:

  • vcam: The name of a GameObject containing a CinemachineVirtualCamera.
  • target: (Optional) The name of a GameObject to look at. Default: speaker.
  • look|follow|both: Set Look At, Follow, or both. Default: both.

Notes:

  • To enable support for Cinemachine, use the Welcome Window.

See Also: Timeline & Cinemachine

Example: (sequencer code)

  • CinemachineTarget(specialCam, speaker) (Make specialCam look at the speaker)

CinemachineZoom()

Syntax: CinemachineZoom(vcam, zoom, [duration])

Changes the orthographic lens size of a 2D Cinemachine virtual camera.

Parameters:

  • vcam: The name of a GameObject containing a CinemachineVirtualCamera.
  • zoom: Target orthographic lens size.
  • duration: (Optional) Duration in seconds over which to transition to zoom. Default: 0 (instant).

Notes:

  • To enable support for Cinemachine, use the Welcome Window.

See Also: Timeline & Cinemachine

Example: (sequencer code)

  • CinemachineZoom(specialCam, 2, 3) (Zoom to orthographic size 2 over 3 seconds)

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)

DOF()

Syntax: DOF(subject|off, [duration], [volumeSubject])

Description: Updates the Post Processing Stack's Depth of Field effect to focus on a subject.

Parameters:

  • subject: The subject to focus the depth of field effect on. If this parameter is off, turns off the effect instead.
  • duration: If non-zero, the duration over which to keep updating the effect's distance. Use this if you're moving the camera and want to keep the effect distance updated.
  • volumeSubject: If specified, use the PostProcessVolume component & profile on the GameObject named by volumeSubject. If this parameter is omitted, first looks for a PostProcessVolume on the main camera. If it doesn't find one on the main camera, it uses the first one it finds in the scene.

Notes:

  • To make this command available, import Third Party Support / PostProcessing Support. You must have also imported Unity's Post Processing Stack v2 into your project.

Example: (sequencer code)

  • Camera(Closeup,Bob,2); DOF(Bobs Head,2) (Sets DOF distance to 'Bobs Head' while zooming into a closeup on Bob)

Fade()

Syntax: Fade(in|out|stay|unstay[, 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.
  • The unstay keyword works like in except it does not fade in if the screen is already visible.
  • stay and unstay work from the fader's current alpha; in and out fade from alpha 1 to 0 and from 0 to 1, respectively.
  • 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).)

GotoEntry()

Syntax: GotoEntry(entry[, conversation]])

Description: Jumps to a dialogue entry.

Parameters:

  • entry: Entry Title or Dialogue Text.
  • conversation: (Optional) Conversation Title. Default: current conversation.

Example: (sequencer code)

  • GotoEntry(Goodbye) (Jumps to the entry whose Title or Dialogue Text is "Goodbye".)

HidePanel()

Syntax: HidePanel(panelNumber[, portrait|portraitimage])

Description: Hides a standard dialogue UI subtitle panel or its portrait. The panel will automatically reappear the next time a dialogue entry node uses it.

Parameters:

  • panelNumber: Subtitle panel number to hide.
  • portrait or portraitimage: (Optional) If portrait is specified as the second parameter, only hides the portrait image and name. If portraitimage is specified, only hides the portait image but not the name. Note that these are special keywords. Specify exactly portrait or portraitimage, not a filename or actor name.

Examples: (sequencer code)

  • HidePanel(0) (Hides subtitle panel 0, which is typically the main NPC subtitle panel.)
  • HidePanel(1, portrait) (Hides subtitle panel 1's portrait image and name but leaves the rest of the panel visible.)

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], [additive])

Description: Loads a new scene. It tries, in order:

  • SaveSystem (to handle scene transitions and persistent data), or
  • LevelManager (to handle persistent data), or
  • manually calls PersistentDataManager.Record() to tell objects in the current level to record their persistent data first, and then it calls LevelWillBeUnloaded() to tell the objects to ignore the upcoming OnDestroy() if they have OnDestroy() handlers.

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.
  • additive: If a third parameter is specified and is exactly 'additive', then this command will load the scene additively. In this case, the spawnpoint will not be used.

Example: (sequencer code)

  • LoadLevel(Shipyard) (Loads the level named "Shipyard")
  • LoadLevel(Shipyard,WestEntrance) (Loads the level named "Shipyard" and places the player at WestEntrance)
  • LoadLevel(SceneToAdd,,additive) (Loads "SceneToAdd" additively to the current scene)

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. If the subject has a NavMeshAgent, uses NavMeshAgent.Warp.

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)

NavMeshAgent()

Syntax: NavMeshAgent(stop|destination[, subject])

Description: Sets a subject's NavMeshAgent to a destination, or stops it.

Parameters:

  • stop|destination: The destination transform to move to, or stop to stop.
  • subject: (Optional) The object to move. Can be speaker, listener, or the name of a game object in the scene. Default: speaker.

Example: (sequencer code)

  • NavMeshAgent(Moonwell, Wisp) (Tells the Wisp's NavMeshAgent to navigate to the Moonwell)

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. If the dialogue entry's Sequence is None() or Continue(), the conversation will not display its subtitle.

Example: (sequencer code)

  • None()

OpenPanel()

Syntax: OpenPanel(panelNumber, [open|close|focus|unfocus])

Description: Opens, closes, focuses, or unfocuses a subtitle panel.

Parameters:

  • panelNumber: The panel number to change.
  • open|close|focus|unfocus: The state to put the panel in. Default: open. If the panel is closed and the state is open, then it will open the panel as if its Visibility dropdown were set to Always From Start, which shows the portrait of the actor that uses the panel.

Example: (sequencer code)

  • OpenPanel(1, open) (Opens subtitle panel 1)

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.


RandomizeNextEntry()

Syntax: RandomizeNextEntry([norepeat])

Description: The next NPC dialogue entry will be randomly chosen from the list of valid NPC dialogue entries instead of using the first one in the list.

Parameters:

  • norepeat: If you pass true, this command will try to avoid choosing the same entry it used the last time RandomizeNextEntry() was called on this entry. Default: false.

Notes: If you want to randomize the first line of a conversation, start it with a blank node whose Sequence is set to RandomizeNextEntry(). From that node, link to the list of random nodes.

Example: (sequencer code)

  • RandomizeNextEntry()

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 command uses Unity's SendMessage(). To send sequencer messages, use SequencerMessage().
  • 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))

SendMessageUpwards()

Syntax: SendMessageUpwards(methodName[, arg[, subject]])

Description: Calls GameObject.SendMessageUpwards(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
    • 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.)

Notes:

  • This command uses Unity's SendMessageUpwards(). To send sequencer messages, use SequencerMessage().
  • Unlike SendMessage(), this command does not accept broadcast or everyone.
  • Remember that, if you specify an argument, it will be passed as a string.

Example: (sequencer code)

  • SendMessageUpwards(Flash, red, listener) (Calls listener.SendMessageUpwards("Flash", "red"), on the listener. The listener and/or its parents should have a method named Flash(string color))

SequencerMessage()

Syntax: SequencerMessage(message)

Description: Sends a message to the sequencer. Equivalent to C# Sequencer.Message("message");.

Parameters:

  • message: The message to send.

Notes:

  • This command sends a sequencer message. To use Unity's SendMessage() method, use SendMessage().

Example: (sequencer code)

  • SequencerMessage(Dance) (Sends the message "Dance" to the sequencer.)

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. You can use this command if you need to temporarily change the continue button mode during a dialogue entry's sequence.

Parameter:

See Also: Continue([all])

Example: (sequencer code)

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

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


SetDialoguePanel()

Syntax: SetDialoguePanel(true|false, [immediate])

Description: Shows or hides the dialogue panel (i.e., the entire dialogue UI).

Parameters:

  • true|false: Show or hide.
  • immediate: If specified for SetDialoguePanel(false), immediately hides the dialogue panel instead of playing its hide animation. Useful particularly if you are hiding the dialogue panel at the beginning of a conversation. If showing again after hiding at the beginning of a conversation, you may need to trigger your subtitle panel(s)' Show animations depending on your dialogue UI.

Notes:

  • SetDialoguePanel(false) will not clear subtitle text. This is so you can call SetDialoguePanel(true) to show the dialogue UI (and its current text) again.
  • See SetPanel() to set an actor's subtitle panel.
  • See SetMenuPanel() to set an actor's menu panel.

Examples: (sequencer code)

  • SetDialoguePanel(false); SetDialoguePanel(true)@2 (Hide the dialogue UI for 2 seconds)
  • SetDialoguePanel(false,immediate); SetDialoguePanel(true)@2; AnimatorTrigger(Show,NPC Subtitle Panel) (Hide the dialogue UI for 2 seconds at the beginning of the conversation and show the NPC Subtitle Panel when showing the dialogue UI again)

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)

SetMenuPanel()

Syntax: SetMenuPanel(actorName, panelID)

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

Parameters:

  • actorName: The name of the dialogue actor. Default: speaker.
  • panelID: A menu panel number or 'default' for the default panel.

Notes:

Examples: (sequencer code)

  • SetMenuPanel(Bob, 1) (Changes Bob's menu panel to panel 1)

SetPanel()

Syntax: SetPanel(actorName, panelID, [immediate])

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 or 'custom' to use the custom panel assigned to the actor's Dialogue Actor component ('custom' assumes component exists).
  • immediate: (Optional) If specified as the third parameter, panel change takes effect immediately.

Notes:

Examples: (sequencer code)

  • SetPanel(Bob, 2) (Changes Bob's subtitle panel to panel 2; takes effect next line)
  • SetPanel(Joe, 1, immediate) (Changes Joe's subtitle panel to panel 1 immediately)

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.
  • This command applies to conversation subtitles but not to barks. For barks, use the [pic=#] markup tag in text.
  • 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.
  • This command sets the global timeout value as seen in the Dialogue Manager's Input Settings section. If you only want to change the timeout value for a single menu, use it in the dialogue entry before the menu to set a new value, and then use it in the entr(ies) after the menu to restore the original value.

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

StopConversation()

Syntax: StopConversation()

Description: Stops the current conversation.

Example: (sequencer code)

  • StopConversation()

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.
  • More details on the forum at: How To: Read Input From Player During Conversations

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, stop, or speed.
    • If the mode is speed, the third parameter must be the speed value [0..1].
    • Note: Setting speed to zero is generally a better way to pause than using pause*.
  • 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:

  • To enable support for Timeline, use the Welcome Window.
  • When a timeline pauses and resumes using the pause and resume modes above, it will replay any playables at the current time in the timeline, including one-off playables such as Bark. If you don't want this to happen, use the speed mode to set the timeline's speed to 0 instead of pausing.
  • [Version 2.2.35+] If the timeline's Wrap Mode is set to Loop, this command will not stop on its own. It will allow the timeline to keep looping.

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 [, crossfadeDuration [, layer]]]])

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.
  • crossfadeDuration: (Optional) The duration to crossfade into the state. Default: 0 (play immediately)
  • layer: (Optional) The layer containing the state. Default: -1 (any layer)

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.
  • If the specified audio clip doesn't exist, this command will not report a warning unless you set the static property Sequencer.reportMissingAudioFiles true.

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, [message...])

Description: Waits until another sequencer command sends a sequencer message using ->Message(message) or a C# script calls Sequencer.Message(message).

Parameters:

  • message: The message to wait for. You can specify multiple messages separated by commas, in which case WaitForMessage() will wait for all messages.

Note: Combined with the SendMessage() command, you can devise back-and-forth interaction between GameObjects and sequences.

Example: (sequencer code)

  • SendMessage(StartDrilling,,Drill); WaitForMessage(StruckOil)
    (Sends "StartDrilling" [without any arguments] to the GameObject named Drill. Then waits until it a script on Drill calls Sequencer.Message("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