๐Ÿ“ขNotifications

Note that the tools demonstrated in this page are accessible from MSquared v22

Notification example with a texture and text "Local Notification Test"

The notifications system queues and displays notifications passed to clients as packed structs. Users can specify the parameters they want to pass to these structs.

Notification Data

A notification requires three variables to be sent:

  • Notification Type: An indentifier for the notification system to store the notifications (doesn't require uniqueness)

  • Notification Time: The notification display duration

  • Notification Payload: A morpheus packed struct that wraps any struct the user wants to pass

Example creation of an M2_NotificationData struct

Sending Notifications

You can either send a notification to the local client as a local notification or to send a global notification which would be sent to all clients

Local notification example
Global notification example

Displaying Notifications

To display notifications on the user interface, we should hook the widget to events sent by the notifications singleton. Notifications sent will also send a notification ID which is used to uniquely identify notifications.

An example can be found in WBP_NotificationsDisplayExample which binds to the delegates as follows:

An example user interface implementation for notifications

All Notifications System Functions

  • Send Local Notification: Send a notification to the local client

  • Send Global Notification: Send a notification to all clients

  • Remove Notifications by Type: Remove notifications of type

  • Remove Notifications by Id: Remove notification with Id

  • Remove All Notifications: Removes all notifications

Changing the queueing order

If the user wants to change the way notifications are ordered in the queue, they can create a blueprint with parent M2M_NotificationsSingleton and override the GetNextNotificationIndex function. An example last in first out example is:

Example Get Next Notification Index override

After creating this blueprint class, we need to assign it as the notifications system singleton class under: World Settings -> Notifications Singleton Class

Last updated