Page 1 of 1

Multiple Alerts

Posted: Sat Feb 17, 2024 8:59 am
by Ronia
Hi!

I'm trying to display multiple alerts at the same time. I have seen that there is a post on the forum about this same thing, but it does not cover my case.

I'm using the SMS Dialogue UI, which has templates for the NPC and PC Subtitles and every time it wants to show a new message, it copies them and enters the corresponding text, allowing you to have several messages at the same time. This is what I would like to be able to do with the alerts, have a template and clone it to be able to show several alert UIs at the same time.

Thank you so much!

Re: Multiple Alerts

Posted: Sat Feb 17, 2024 9:15 am
by Tony Li
Hi,

The Dialogue System's standard dialogue UI system doesn't do that by default. You can queue alerts so that the next one in the queue will appear as soon as the current one disappears. But to show multiple at the same time you'll need to do a little scripting. Make a subclass of StandardDialogueUI that overrides the ShowAlert() method to show multiple alerts at the same time. If you don't want to do too much scripting and don't mind a small purchase, you could just redirect your overridden ShowAlert() method to Animmal's Ultimate Notification System. (Page 12 of the Ultimate Notification System's manual also has additional tips for using it with the Dialogue System.) The subclass might look something like:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;
using Animmal.NotificationSystem;

public class MyCustomDialogueUI : StandardDialogueUI
{
    public override ShowAlert(string message, float duration)
    {
        var notificationData = new NotificationData();
        notificationData.Texts.Add(message);
        NotificationManager.Instance.ShowNotification(“Alert”, notificationData);
    }
}