Detailed Member Reference

Namespace: Canley.Utility.Notifications
Class: CanleyNotificationService

GetNotification

public static CanleyNotificationRecord? GetNotification(string id)
  • Description: Retrieves a specific notification record by its unique ID. Returns null if no matching record is found.

  • Parameters:

    • id (string): The unique GUID of the notification to query.
  • Workflow:

    1. Queue Search: Scans the active local notification registry using the supplied string identifier.
    2. Snapshot Return: If found, wraps the data into a read-only CanleyNotificationRecord struct; otherwise, returns null.
  • Return Type: CanleyNotificationRecord? (Nullable value type)

  • Access: Public Static

  • Example:

using Canley.Utility.Notifications;
using UnityEngine;
 
public class NotificationInspector : MonoBehaviour 
{
    public void InspectNotification(string noteId) 
    {
        // Retrieve a specific notification record by its unique ID
        var record = CanleyNotificationService.GetNotification(noteId);
 
        if (record.HasValue)
        {
            Debug.Log($"Found notification: {record.Value.Title} | Repeats: {record.Value.Repeats}");
        }
        else
        {
            Debug.Log("Notification not found or already fired.");
        }
    }
}

TIP

Because GetNotification returns a nullable struct (CanleyNotificationRecord?), always check the .HasValue property before attempting to read properties like Title or Repeats to avoid null-reference handling issues.