How to check if alert is shown?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
papapa909090
Posts: 5
Joined: Fri Aug 28, 2020 2:12 am

How to check if alert is shown?

Post 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
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to check if alert is shown?

Post 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 211 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.");
}
Post Reply