Skip to content

Commit cbfe78c

Browse files
author
Miguel Tomas
committed
**Fixed**:
- Fixed NullReferenceException error when scheduling a notification in the editor
1 parent e2f3e02 commit cbfe78c

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this package will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [0.1.6] - 2020-08-03
8+
9+
**Fixed**:
10+
- Fixed NullReferenceException error when scheduling a notification in the editor
11+
712
## [0.1.5] - 2020-08-03
813

914
**Fixed**:

Runtime/MobileNotificationService.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ public IGameNotification CreateNotification()
100100
/// <inheritdoc />
101101
public PendingNotification ScheduleNotification(IGameNotification gameNotification)
102102
{
103+
#if UNITY_EDITOR
104+
if (!gameNotification.Id.HasValue)
105+
{
106+
// Generate an ID for items that don't have one (just so they can be identified later)
107+
gameNotification.Id = Math.Abs(DateTime.Now.ToString("yyMMddHHmmssffffff").GetHashCode());
108+
}
109+
return new PendingNotification(gameNotification);
110+
#endif
103111
return _monoBehaviour.ScheduleNotification(gameNotification);
104112
}
105113

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.gamelovers.notificationservice",
33
"displayName": "Notification Service",
4-
"version": "0.1.5",
4+
"version": "0.1.6",
55
"unity": "2019.4",
66
"description": "This package provides an easier to use service to help manage the notification sent to mobile devices, and based on the Unity's Mobile Notifications package.\nIt allows to schedule local notifications, receive remote notifications and clear any type of notification.",
77
"dependencies": {

0 commit comments

Comments
 (0)