Skip to content

Commit 0282c1b

Browse files
committed
update packages
add default app id for example app
1 parent 0aa6a57 commit 0282c1b

11 files changed

Lines changed: 1607 additions & 87 deletions

File tree

OneSignalExample/Assets/OneSignal/Example/OneSignalExampleBehaviour.cs

Lines changed: 58 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class OneSignalExampleBehaviour : MonoBehaviour
6363
/// <summary>
6464
/// set to your app id (https://documentation.onesignal.com/docs/keys-and-ids)
6565
/// </summary>
66-
public string appId;
66+
public string appId = "77e32082-ea27-42e3-a898-c72e141824ef";
6767

6868
/// <summary>
6969
/// whether you would prefer OneSignal Unity SDK prevent initialization until consent is granted via
@@ -127,17 +127,17 @@ public class OneSignalExampleBehaviour : MonoBehaviour
127127
public string eventName;
128128

129129
/// <summary>
130-
///
130+
///
131131
/// </summary>
132132
public string eventPropertyKey;
133133

134134
/// <summary>
135-
///
135+
///
136136
/// </summary>
137137
public string eventPropertyValue;
138138

139139
/// <summary>
140-
///
140+
///
141141
/// </summary>
142142
public string liveActivityId;
143143

@@ -476,19 +476,56 @@ public void GetTags()
476476
_log($"Get all user tags " + dictionaryString.TrimEnd(',', ' ') + "}");
477477
}
478478

479-
public void TrackEvent() {
480-
var properties = new Dictionary<string, object> {
481-
{ eventPropertyKey, eventPropertyValue },
482-
{ "timestamp", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") },
483-
{ "platform", "Unity" }
479+
public void TrackEvent()
480+
{
481+
// Detect platform
482+
string platform =
483+
Application.platform == RuntimePlatform.Android ? "android"
484+
: Application.platform == RuntimePlatform.IPhonePlayer ? "ios"
485+
: "unknown";
486+
487+
// Track event without properties
488+
_log($"Tracking event <b>Unity-{platform}-noprops</b> without properties");
489+
OneSignal.User.TrackEvent($"Unity-{platform}-noprops");
490+
491+
// Track event with comprehensive properties
492+
var properties = new Dictionary<string, object>
493+
{
494+
{ "someNum", 123 },
495+
{ "someFloat", 3.14159f },
496+
{ "someString", "abc" },
497+
{ "someBool", true },
498+
{
499+
"someObject",
500+
new Dictionary<string, object>
501+
{
502+
{ "abc", "123" },
503+
{
504+
"nested",
505+
new Dictionary<string, object> { { "def", "456" } }
506+
},
507+
}
508+
},
509+
{
510+
"someArray",
511+
new List<object> { 1, 2 }
512+
},
513+
{
514+
"someMixedArray",
515+
new List<object>
516+
{
517+
1,
518+
"2",
519+
new Dictionary<string, object> { { "abc", "123" } },
520+
}
521+
},
522+
{ "someNull", null },
484523
};
485-
_log($"Tracking event <b>{eventName}</b> with properties: {Json.Serialize(properties)}");
486-
OneSignal.User.TrackEvent(eventName, properties);
487-
}
488524

489-
public void TrackEventSimple() {
490-
_log($"Tracking simple event <b>{eventName}</b> without properties");
491-
OneSignal.User.TrackEvent(eventName);
525+
_log(
526+
$"Tracking event <b>Unity-{platform}</b> with properties: {Json.Serialize(properties)}"
527+
);
528+
OneSignal.User.TrackEvent($"Unity-{platform}", properties);
492529
}
493530

494531
/*
@@ -638,12 +675,15 @@ public void RemovePushToStartToken()
638675
public void SetLiveActivityTypeToken(string newVal) => liveActivityTypeToken = newVal;
639676

640677
public void SetEventName(string newVal) => eventName = newVal;
678+
641679
public void SetEventPropertyKey(string newVal) => eventPropertyKey = newVal;
680+
642681
public void SetEventPropertyValue(string newVal) => eventPropertyValue = newVal;
643682

644-
private void Awake() {
645-
SDKDebug.LogIntercept += _log;
646-
SDKDebug.WarnIntercept += _warn;
683+
private void Awake()
684+
{
685+
SDKDebug.LogIntercept += _log;
686+
SDKDebug.WarnIntercept += _warn;
647687
SDKDebug.ErrorIntercept += _error;
648688
appIdText.text = appId;
649689
}

OneSignalExample/Assets/Settings.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OneSignalExample/Assets/Settings/Build Profiles.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OneSignalExample/Packages/manifest.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
"com.onesignal.unity.android": "file:../../com.onesignal.unity.android",
44
"com.onesignal.unity.core": "file:../../com.onesignal.unity.core",
55
"com.onesignal.unity.ios": "file:../../com.onesignal.unity.ios",
6-
"com.unity.ai.navigation": "1.1.4",
7-
"com.unity.ide.rider": "3.0.24",
8-
"com.unity.ide.visualstudio": "2.0.18",
9-
"com.unity.ide.vscode": "1.2.5",
10-
"com.unity.test-framework": "1.1.33",
11-
"com.unity.textmeshpro": "3.0.6",
12-
"com.unity.timeline": "1.7.5",
13-
"com.unity.toolchain.macos-x86_64-linux-x86_64": "2.0.4",
14-
"com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.4",
15-
"com.unity.ugui": "1.0.0",
6+
"com.unity.ai.navigation": "2.0.9",
7+
"com.unity.ide.rider": "3.0.38",
8+
"com.unity.ide.visualstudio": "2.0.23",
9+
"com.unity.multiplayer.center": "1.0.0",
10+
"com.unity.test-framework": "1.6.0",
11+
"com.unity.timeline": "1.8.9",
12+
"com.unity.toolchain.macos-x86_64-linux-x86_64": "2.0.10",
13+
"com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.10",
14+
"com.unity.ugui": "2.0.0",
15+
"com.unity.modules.accessibility": "1.0.0",
1616
"com.unity.modules.ai": "1.0.0",
1717
"com.unity.modules.androidjni": "1.0.0",
1818
"com.unity.modules.animation": "1.0.0",

OneSignalExample/Packages/packages-lock.json

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
}
2424
},
2525
"com.unity.ai.navigation": {
26-
"version": "1.1.5",
26+
"version": "2.0.9",
2727
"depth": 0,
2828
"source": "registry",
2929
"dependencies": {
@@ -38,14 +38,13 @@
3838
"dependencies": {}
3939
},
4040
"com.unity.ext.nunit": {
41-
"version": "1.0.6",
41+
"version": "2.0.5",
4242
"depth": 1,
43-
"source": "registry",
44-
"dependencies": {},
45-
"url": "https://packages.unity.com"
43+
"source": "builtin",
44+
"dependencies": {}
4645
},
4746
"com.unity.ide.rider": {
48-
"version": "3.0.35",
47+
"version": "3.0.38",
4948
"depth": 0,
5049
"source": "registry",
5150
"dependencies": {
@@ -54,59 +53,50 @@
5453
"url": "https://packages.unity.com"
5554
},
5655
"com.unity.ide.visualstudio": {
57-
"version": "2.0.22",
56+
"version": "2.0.23",
5857
"depth": 0,
5958
"source": "registry",
6059
"dependencies": {
6160
"com.unity.test-framework": "1.1.9"
6261
},
6362
"url": "https://packages.unity.com"
6463
},
65-
"com.unity.ide.vscode": {
66-
"version": "1.2.5",
64+
"com.unity.multiplayer.center": {
65+
"version": "1.0.0",
6766
"depth": 0,
68-
"source": "registry",
69-
"dependencies": {},
70-
"url": "https://packages.unity.com"
67+
"source": "builtin",
68+
"dependencies": {
69+
"com.unity.modules.uielements": "1.0.0"
70+
}
7171
},
7272
"com.unity.sysroot": {
73-
"version": "2.0.5",
73+
"version": "2.0.10",
7474
"depth": 1,
7575
"source": "registry",
7676
"dependencies": {},
7777
"url": "https://packages.unity.com"
7878
},
7979
"com.unity.sysroot.linux-x86_64": {
80-
"version": "2.0.4",
80+
"version": "2.0.9",
8181
"depth": 1,
8282
"source": "registry",
8383
"dependencies": {
84-
"com.unity.sysroot": "2.0.5"
84+
"com.unity.sysroot": "2.0.10"
8585
},
8686
"url": "https://packages.unity.com"
8787
},
8888
"com.unity.test-framework": {
89-
"version": "1.1.33",
89+
"version": "1.6.0",
9090
"depth": 0,
91-
"source": "registry",
91+
"source": "builtin",
9292
"dependencies": {
93-
"com.unity.ext.nunit": "1.0.6",
93+
"com.unity.ext.nunit": "2.0.3",
9494
"com.unity.modules.imgui": "1.0.0",
9595
"com.unity.modules.jsonserialize": "1.0.0"
96-
},
97-
"url": "https://packages.unity.com"
98-
},
99-
"com.unity.textmeshpro": {
100-
"version": "3.0.7",
101-
"depth": 0,
102-
"source": "registry",
103-
"dependencies": {
104-
"com.unity.ugui": "1.0.0"
105-
},
106-
"url": "https://packages.unity.com"
96+
}
10797
},
10898
"com.unity.timeline": {
109-
"version": "1.7.7",
99+
"version": "1.8.9",
110100
"depth": 0,
111101
"source": "registry",
112102
"dependencies": {
@@ -118,34 +108,40 @@
118108
"url": "https://packages.unity.com"
119109
},
120110
"com.unity.toolchain.macos-x86_64-linux-x86_64": {
121-
"version": "2.0.4",
111+
"version": "2.0.10",
122112
"depth": 0,
123113
"source": "registry",
124114
"dependencies": {
125-
"com.unity.sysroot": "2.0.5",
126-
"com.unity.sysroot.linux-x86_64": "2.0.4"
115+
"com.unity.sysroot": "2.0.10",
116+
"com.unity.sysroot.linux-x86_64": "2.0.9"
127117
},
128118
"url": "https://packages.unity.com"
129119
},
130120
"com.unity.toolchain.win-x86_64-linux-x86_64": {
131-
"version": "2.0.4",
121+
"version": "2.0.10",
132122
"depth": 0,
133123
"source": "registry",
134124
"dependencies": {
135-
"com.unity.sysroot": "2.0.5",
136-
"com.unity.sysroot.linux-x86_64": "2.0.4"
125+
"com.unity.sysroot": "2.0.10",
126+
"com.unity.sysroot.linux-x86_64": "2.0.9"
137127
},
138128
"url": "https://packages.unity.com"
139129
},
140130
"com.unity.ugui": {
141-
"version": "1.0.0",
131+
"version": "2.0.0",
142132
"depth": 0,
143133
"source": "builtin",
144134
"dependencies": {
145135
"com.unity.modules.ui": "1.0.0",
146136
"com.unity.modules.imgui": "1.0.0"
147137
}
148138
},
139+
"com.unity.modules.accessibility": {
140+
"version": "1.0.0",
141+
"depth": 0,
142+
"source": "builtin",
143+
"dependencies": {}
144+
},
149145
"com.unity.modules.ai": {
150146
"version": "1.0.0",
151147
"depth": 0,
@@ -193,6 +189,12 @@
193189
"com.unity.modules.animation": "1.0.0"
194190
}
195191
},
192+
"com.unity.modules.hierarchycore": {
193+
"version": "1.0.0",
194+
"depth": 1,
195+
"source": "builtin",
196+
"dependencies": {}
197+
},
196198
"com.unity.modules.imageconversion": {
197199
"version": "1.0.0",
198200
"depth": 0,
@@ -281,7 +283,9 @@
281283
"dependencies": {
282284
"com.unity.modules.ui": "1.0.0",
283285
"com.unity.modules.imgui": "1.0.0",
284-
"com.unity.modules.jsonserialize": "1.0.0"
286+
"com.unity.modules.jsonserialize": "1.0.0",
287+
"com.unity.modules.hierarchycore": "1.0.0",
288+
"com.unity.modules.physics": "1.0.0"
285289
}
286290
},
287291
"com.unity.modules.umbra": {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!655991488 &1
4+
MultiplayerManager:
5+
m_ObjectHideFlags: 0
6+
m_EnableMultiplayerRoles: 0
7+
m_StrippingTypes: {}

0 commit comments

Comments
 (0)