Detailed Member Reference
Namespace: Canley.Utility.Notifications
Class: CanleyNotificationService
RemoveNotification
public static void RemoveNotification(string id)-
Description: Immediately cancels and removes a specific notification from the system queue using its unique ID.
-
Parameters:
id(string): The unique GUID of the notification to remove.
-
Workflow:
- Queue Lookup: Searches the active local notification registry for the matching string identifier.
- Purge: Cancels the pending OS alert and clears it from the notification center.
-
Return Type:
void -
Access: Public Static
-
Example:
using Canley.Utility.Notifications;
using UnityEngine;
public class QuestManager : MonoBehaviour
{
private string _questNotificationId;
public void OnQuestCompleted(string questId)
{
// If a notification was scheduled for this quest, clear it out immediately
if (!string.IsNullOrEmpty(_questNotificationId))
{
CanleyNotificationService.RemoveNotification(_questNotificationId);
Debug.Log($"Removed pending notification for completed quest: {_questNotificationId}");
_questNotificationId = null;
}
}
}TIP
Calling
RemoveNotificationon an ID that has already fired or doesn’t exist is completely safe and won’t throw errors, making it simple to drop into cleanup flows without heavy pre-checks.