๐ขNotifications
Note that the tools demonstrated in this page are accessible from MSquared v22
![](https://docs.msquared.io/~gitbook/image?url=https%3A%2F%2F1456550285-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FoWTlPaoHd1McSakqMigu%252Fuploads%252F4HwEtfYNy0JFasTzsPPO%252Fimage.png%3Falt%3Dmedia%26token%3Da90beb05-a89d-4dde-8e1f-3f6c06df4991&width=768&dpr=4&quality=100&sign=80c467c4&sv=1)
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
![](https://docs.msquared.io/~gitbook/image?url=https%3A%2F%2F1456550285-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FoWTlPaoHd1McSakqMigu%252Fuploads%252F2I4ZR0j2jtcK0EuJCzMs%252Fimage.png%3Falt%3Dmedia%26token%3D411721f6-9c37-4abe-b8e2-70717b5ea8ca&width=768&dpr=4&quality=100&sign=577502b4&sv=1)
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
![](https://docs.msquared.io/~gitbook/image?url=https%3A%2F%2F1456550285-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FoWTlPaoHd1McSakqMigu%252Fuploads%252FRXWhdoTtubcVOcYRU8D1%252Fimage.png%3Falt%3Dmedia%26token%3Dc0ddbbd8-d94d-4d87-bf40-9e480a02189b&width=768&dpr=4&quality=100&sign=80988877&sv=1)
![](https://docs.msquared.io/~gitbook/image?url=https%3A%2F%2F1456550285-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FoWTlPaoHd1McSakqMigu%252Fuploads%252FXjmiFQxD4SiLwZbO1Q2q%252Fimage.png%3Falt%3Dmedia%26token%3D5d7e331a-56d8-4c95-b548-644d3d7793db&width=768&dpr=4&quality=100&sign=5c50b06b&sv=1)
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:
![](https://docs.msquared.io/~gitbook/image?url=https%3A%2F%2F1456550285-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FoWTlPaoHd1McSakqMigu%252Fuploads%252FWfLbqPHOGAi45VmmFWhf%252Fimage.png%3Falt%3Dmedia%26token%3Db2b4c38a-8efb-4c63-a0d9-55c4c47f09c7&width=768&dpr=4&quality=100&sign=6f15a6e&sv=1)
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:
![](https://docs.msquared.io/~gitbook/image?url=https%3A%2F%2F1456550285-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FoWTlPaoHd1McSakqMigu%252Fuploads%252FGYusXYtHsmyHs8vgKnfN%252Fimage.png%3Falt%3Dmedia%26token%3Dd7fbf9fb-02f0-4ded-8802-75016708966b&width=768&dpr=4&quality=100&sign=a1708a27&sv=1)
After creating this blueprint class, we need to assign it as the notifications system singleton class under: World Settings -> Notifications Singleton Class
Last updated