DialogueManager.Unpause(); is stopping my animations

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
bluebuttongames
Posts: 91
Joined: Tue Jul 14, 2015 8:22 am

DialogueManager.Unpause(); is stopping my animations

Post by bluebuttongames »

Took me ages to track it down to this line of code, but this is actually putting my animations on the player character in an Idle state.

Is there a way I can get around this?

Thanks,

BB
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: DialogueManager.Unpause(); is stopping my animations

Post by Tony Li »

Hi,

DialogueManager.Unpause() does two things:

1. Unpauses DialogueTime, and

2. Broadcasts "OnDialogueSystemUnpause" to the Dialogue Manager and, if a conversation is active, the primary Actor & Conversant.

If you suspect the issue is related to DialogueTime, here's more info:
DialogueTime is essentially a wrapper for Unity's Time class. However, it can work in one of two modes:
  • Realtime: (Default) Unaffected by Time.timeScale.
  • Gameplay: Affected by Time.timeScale, just like Unity's Time class.
Many games pause (Time.timeScale=0) during conversations. The Dialogue System uses Realtime by default to allow the Dialogue System's time-based functionality to work even if the game is paused.

However, if you've changed DialogueTime's mode to Gameplay, then it maps directly to Unity's Time class. In this case, if you pause DialogueTime it sets Time.timeScale=0. If you unpause DialogueTime, it sets Time.timeScale=1. Could this be affecting your animation control scripts?


If you suspect the OnDialogueSystemUnpause message is the issue, here's more info:
The only Dialogue System operations that react to OnDialogueSystemUnpause are:
  • AudioWait() and Voice() sequencer commands
  • The Dialogue System Events component invokes any event handlers you've registered for the OnDialogueSystemUnpause event.
Do you perhaps have a script somewhere with an OnDialogueSystemUnpause method?

What's your reason for calling DialogueManager.Unpause()?
bluebuttongames
Posts: 91
Joined: Tue Jul 14, 2015 8:22 am

Re: DialogueManager.Unpause(); is stopping my animations

Post by bluebuttongames »

I've been using DialogueManager.Pause(); and Unpause because once a line is delivered I do various things that take a few seconds before I want the responses to come through, so I've been pausing to delay, doing my stuff then unpausing. Is there a better way to do that?
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: DialogueManager.Unpause(); is stopping my animations

Post by Tony Li »

Yes. The typical way is to through the dialogue entry's Sequence. The Dialogue System won't move on from a dialogue entry's line until its Sequence is done, or until the player clicks the continue button if you're using continue buttons.

If you want the line to stay onscreen for 5 seconds before the response menu appears, set the Sequence field to:
  • Sequence: Delay(5)
If the Sequence field is blank, it uses the Dialogue Manager's Default Sequence, which is initially set to:
  • Default Sequence: Delay({{end}})
The {{end}} keyword is a value based on the length of the dialogue text and the Dialogue Manager's Subtitle Settings.

Sequences can also wait for external events. Use the "@Message(xyz)" syntax, like this:
  • Sequence: None()@Message(qWasPressed)
where the message "qWasPressed" is an arbitrary string sent by one of your scripts:

Code: Select all

void Update() {
    if (Input.GetKeyDown(KeyCode.Q)) {
        Sequencer.Message("qWasPressed");
    }
}
The None() sequencer command is just an empty command that does nothing. But it doesn't run until the sequencer receives the "qWasPressed" message, which causes the sequence to wait until then.

You can also write your own custom sequencer commands. They're actually very simple to write. You could write a command that runs until you're done doing your stuff. Then you'd use it like this:
  • Sequence: DoMyStuff()
bluebuttongames
Posts: 91
Joined: Tue Jul 14, 2015 8:22 am

Re: DialogueManager.Unpause(); is stopping my animations

Post by bluebuttongames »

Ah yes. I was doing that originally, but that meant every single entry I wrote would have to use this sequence. Every line I use goes through this process which is why I was using pause.

Can I override the default behaviour?
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: DialogueManager.Unpause(); is stopping my animations

Post by Tony Li »

What about setting the Dialogue Manager's Default Sequence? If your entries' Sequence fields are blank, they'll use the Default Sequence.

Another option is to add a script that has an OnConversationLine method that manually adds the command to every sequence:

Code: Select all

void OnConversationLine(Subtitle subtitle) {
    subtitle.sequence += "; None()@Message(xyz)"
} 
Post Reply