Problems displaying multiple alerts on pause

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Dralks
Posts: 44
Joined: Mon May 24, 2021 6:19 pm

Problems displaying multiple alerts on pause

Post by Dralks »

Hi!

I'm currently displaying multiple alerts in some scenarios but I'm having some issues:

The Dialog UI component 'Queue alert' does not work if the alerts are being created while the game is paused (I have the mode set to 'realtime' but that doesn't seem to solve the issue), the first alert displays normally but the others only appear when the game is running again.

To go around the issue above I wanted to unselect the queue alerts and display alerts from a script with 'DialogueManager.ShowAlert()', that kind of works but I can't see any way to know that there is no alerts being displayed (so I don't remove an existing alert while it is typewriting).
User avatar
Tony Li
Posts: 22159
Joined: Thu Jul 18, 2013 1:27 pm

Re: Problems displaying multiple alerts on pause

Post by Tony Li »

Hi,

How are you queueing the alerts? If the Dialogue Manager's Other Settings > Dialogue Time Mode is set to Realtime, alerts will run based on the system clock, not on Time.timeScale. So if you pause the game by setting Time.timeScale to zero, it won't affect alerts.

However, if the alert panel's Animator > Update Mode is set to Normal, the Animator won't run while the game is paused. That may be what's causing the alerts to stop (i.e., waiting for the hide animation).

To check if an alert is currently visible, you can check DialogueManager.standardDialogueUI.alertControls.isVisible -- but I don't think you'll need to do this if you can figure out what's preventing queued alerts from appearing in the first place.
Dralks
Posts: 44
Joined: Mon May 24, 2021 6:19 pm

Re: Problems displaying multiple alerts on pause

Post by Dralks »

Hi Tony, thanks for answering, I'm always impressed with your costumer service, makes me want to throw money at you.

The issue with pause seems to be because I had 'Wait For Hide Animation' selected, that totally blocks alerts on pause.

I'm afraid that 'standardDialogueUI' is not accessible from the Dialoguemanager, I can see this DialogUI (instance) object in there but it doesn't seem to have any reference to it 'IsAlertVisible' or the 'alertControls' object but I could see it being used so I added a new method in the dialogue interface to access it, which leaves me with:

in the DialogueUI interface:

Code: Select all

bool IsAlertVisible();
in the abstract dialogue UI:

Code: Select all

        public bool IsAlertVisible()
        {
            return alertControls.isVisible;
        }

Code: Select all

DialogueManager.instance.dialogueUI.IsAlertVisible()
the above is not ideal because I had to update important third party files, if you ever do an update I assume that I will lose those changes.

This works and gives me the information I need to process everything correctly, but typewriter is still an issue, I can see that "HideAlert" does not close the alert UI panel if the game is paused, which means that the first message shows with typewriter normally, but the messages after that shows instantly, my guess is that alerts only refresh the typewriter when you set it active for the first time then it just ignores typewriter all together, the typewriter works as expected if the game is not paused because the alert window is closing and opening with every alert, so right now I just need to figure out how to have the typewriter up and running beyond the first message when the game is paused.
Dralks
Posts: 44
Joined: Mon May 24, 2021 6:19 pm

Re: Problems displaying multiple alerts on pause

Post by Dralks »

I can confirm that manually disabling the alert panel fixes all the issues, I did the ugly approach of creating a new method in 'AbstractDialogueUI' that sets the alert panel gameobject to false (.Hide() does hide the panel but leaves the gameobject active).

So closing the alert with this before opening a new one correctly displays the message with typewriter:

Code: Select all

        public void CloseAlertUI()
        {
            gameObject.transform.GetChild(0).gameObject.SetActive(false);
        }
User avatar
Tony Li
Posts: 22159
Joined: Thu Jul 18, 2013 1:27 pm

Re: Problems displaying multiple alerts on pause

Post by Tony Li »

Hi,

The static property DialogueManager.standardDialogueUI was added in a later version.

In older versions, you can do the same with the (DialogueManager.dialogueUI as StandardDialogueUI). This is valid:

Code: Select all

(DialogueManager.dialogueUI as StandardDialogueUI).alertControls.isVisible
Here's an example scene that demonstrates that DialogueManager.ShowAlert() properly queues alerts while paused:

DS_TestAlerts_2021-07-25.unitypackage

It's exported from Unity 2019.4 and Dialogue System 2.2.17.

If you give it a try, can you tell me what's different about your project?
Post Reply