Hi,
I generally use AnimatorPlayWait() and AnimatorPlay(), although it depends on how your animator controller is set up. If your animator controller has transition arrows that lead from one state to another based on animator parameter values, you might need to use sequencer commands such as AnimatorTrigger() and AnimatorBool() that set those animator parameters.
Your mouth animations are working, but it's a good example to start from so I'll describe how I usually set it up. I'll add two animation states to my animator controller: Idle (mouth closed) and Talking (mouth moving). Then I'll use this sequencer command to make the mouth move while the typewriter is typing:
Code: Select all
AnimatorPlay(Talking);
required AnimatorPlay(Idle)@Message(Typed)
The typewriter effect always sends the sequencer message "Typed". The second AnimatorPlay() waits for this message. The "required" keyword is essential. If the player skips ahead before AnimatorPlay() receives the message, the required keyword guarantees that the command runs anyway.
Here's an example that plays a Dance animation state and then returns to Idle when it's done:
Code: Select all
AnimatorPlayWait(Dance)->Message(Done);
required AnimatorPlay(Idle)@Message(Done)
The first command plays the Dance state, waits until it's done, and then sends the message "Done", which is an arbitrary string I chose.
The second command waits for the message "Done" and then plays Idle. If the player skips ahead, the required keyword guarantees that it still goes to Idle.
When I'm using continue buttons, I'll often use this trick:
Code: Select all
AnimatorPlay(Talking);
required AnimatorPlay(Idle)@Message(Continued)
The first command puts the animator in the Talking state. The second command waits for the message "Continued". This is another arbitrary string I chose. Nothing in the Dialogue System actually sends this message. This means the command will wait forever. However, the player can skip ahead by clicking the continue button, at which point the required keyword guarantees that the command will run.