Page 1 of 1

How to check if alert is shown?

Posted: Tue Oct 13, 2020 9:07 am
by papapa909090
Hello, I need to check if alert is shown not to overwrite its text, something like DialogueManager.isConversationActive for Alerts;

I found PixelCrushers.DialogueSystem.UnityUIDialogueUI.alertIsVisible() but it's protected

Re: How to check if alert is shown?

Posted: Tue Oct 13, 2020 9:37 am
by Tony Li
You should ideally be using StandardDialogueUI, not the deprecated UnityUIDialogueUI. (In fact, DS version 2.2.12, which just released today, has removed the deprecated UnityUIDialogueUI prefabs to prevent confusion. They're still available on the Extras page.)

If you're using StandardDialogueUI, the Alert UI Elements section has a Queue Alerts checkbox:

queueAlerts.png
queueAlerts.png (25.13 KiB) Viewed 212 times

If you show an alert while another alert is still visible, the second alert will wait until the first one is done. Then the second one will appear.

If that doesn't cover what you need, you can check the isVisible property:

Code: Select all

if ((DialogueManager.dialogueUI as StandardDialogueUI).alertUIElements.isVisible)
{
    Debug.Log("An alert is currently visible.");
}