Skip to content

Commit 092fcbc

Browse files
authored
Merge pull request #349 from OneSignal/fix/example_fixups
Upgrade example scene YAML format and example code fixups
2 parents 5e0c849 + 6a08207 commit 092fcbc

File tree

2 files changed

+120
-71
lines changed

2 files changed

+120
-71
lines changed

OneSignalExample/Assets/OneSignal/Example/GameControllerExample.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2016 OneSignal
4+
* Copyright 2021 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -42,7 +42,7 @@ public class GameControllerExample : MonoBehaviour {
4242
void Start() {
4343
extraMessage = null;
4444

45-
// Enable line below to debug issues with setuping OneSignal. (logLevel, visualLogLevel)
45+
// Enable line below to debug issues with OneSignal. (logLevel, visualLogLevel)
4646
OneSignal.SetLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE);
4747

4848
// If you set to true, the user will have to provide consent
@@ -53,14 +53,14 @@ void Start() {
5353
// The only required method you need to call to setup OneSignal to receive push notifications.
5454
// Call before using any other methods on OneSignal (except setLogLevel or SetRequiredUserPrivacyConsent)
5555
// Should only be called once when your app is loaded.
56-
// OneSignal.Init(OneSignal_AppId);
5756
OneSignal.StartInit("99015f5e-87b1-462e-a75b-f99bf7c2822e")
5857
.HandleNotificationReceived(HandleNotificationReceived)
5958
.HandleNotificationOpened(HandleNotificationOpened)
6059
.HandleInAppMessageClicked(HandlerInAppMessageClicked)
6160
.EndInit();
6261

6362
OneSignal.inFocusDisplayType = OneSignal.OSInFocusDisplayOption.Notification;
63+
6464
OneSignal.permissionObserver += OneSignal_permissionObserver;
6565
OneSignal.subscriptionObserver += OneSignal_subscriptionObserver;
6666
OneSignal.emailSubscriptionObserver += OneSignal_emailSubscriptionObserver;
@@ -126,7 +126,7 @@ private void OneSignalInAppMessageTriggerExamples() {
126126
// Delete a list of triggers
127127
OneSignal.RemoveTriggersForKeys(new List<string>() { "key1", "key2" });
128128

129-
// Temporarily puase In-App messages; If true is passed in.
129+
// Temporarily pause In-App messages; If true is passed in.
130130
// Great to ensure you never interrupt your user while they are in the middle of a match in your game.
131131
OneSignal.PauseInAppMessages(false);
132132
}
@@ -172,7 +172,7 @@ private void OneSignal_emailSubscriptionObserver(OSEmailSubscriptionStateChanges
172172
Debug.Log("EMAIL stateChanges.to.status: " + stateChanges.to.emailUserId + ", " + stateChanges.to.emailAddress);
173173
}
174174

175-
// Called when your app is in focus and a notificaiton is recieved.
175+
// Called when your app is in focus and a notification is received.
176176
// The name of the method can be anything as long as the signature matches.
177177
// Method must be static or this object should be marked as DontDestroyOnLoad
178178
private static void HandleNotificationReceived(OSNotification notification) {
@@ -277,7 +277,7 @@ void OnGUI() {
277277
extraMessage = "Waiting to get a OneSignal userId. Uncomment OneSignal.SetLogLevel in the Start method if it hangs here to debug the issue.";
278278
OneSignal.IdsAvailable((userId, pushToken) => {
279279
if (pushToken != null) {
280-
// See http://documentation.onesignal.com/docs/notifications-create-notification for a full list of options.
280+
// See https://documentation.onesignal.com/reference/create-notification for a full list of options.
281281
// You can not use included_segments or any fields that require your OneSignal 'REST API Key' in your app for security reasons.
282282
// If you need to use your OneSignal 'REST API Key' you will need your own server where you can make this call.
283283

@@ -291,7 +291,7 @@ void OnGUI() {
291291
extraMessage = "Posting test notification now.";
292292

293293
OneSignal.PostNotification(notification, (responseSuccess) => {
294-
extraMessage = "Notification posted successful! Delayed by about 30 secounds to give you time to press the home button to see a notification vs an in-app alert.\n" + Json.Serialize(responseSuccess);
294+
extraMessage = "Notification posted successful! Delayed by about 30 seconds to give you time to press the home button to see a notification vs an in-app alert.\n" + Json.Serialize(responseSuccess);
295295
}, (responseFailure) => {
296296
extraMessage = "Notification failed to post:\n" + Json.Serialize(responseFailure);
297297
});
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
%YAML 1.1
22
%TAG !u! tag:unity3d.com,2011:
33
--- !u!29 &1
4-
SceneSettings:
4+
OcclusionCullingSettings:
55
m_ObjectHideFlags: 0
6-
m_PVSData:
7-
m_PVSObjectsArray: []
8-
m_PVSPortalsArray: []
6+
serializedVersion: 2
97
m_OcclusionBakeSettings:
108
smallestOccluder: 5
11-
smallestHole: .25
9+
smallestHole: 0.25
1210
backfaceThreshold: 100
11+
m_SceneGUID: 00000000000000000000000000000000
12+
m_OcclusionCullingData: {fileID: 0}
1313
--- !u!104 &2
1414
RenderSettings:
1515
m_ObjectHideFlags: 0
16-
serializedVersion: 6
16+
serializedVersion: 9
1717
m_Fog: 0
18-
m_FogColor: {r: .5, g: .5, b: .5, a: 1}
18+
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
1919
m_FogMode: 3
20-
m_FogDensity: .00999999978
20+
m_FogDensity: 0.01
2121
m_LinearFogStart: 0
2222
m_LinearFogEnd: 300
23-
m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
24-
m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
25-
m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
23+
m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
24+
m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
25+
m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
2626
m_AmbientIntensity: 1
2727
m_AmbientMode: 3
28+
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
2829
m_SkyboxMaterial: {fileID: 0}
29-
m_HaloStrength: .5
30+
m_HaloStrength: 0.5
3031
m_FlareStrength: 1
3132
m_FlareFadeSpeed: 3
3233
m_HaloTexture: {fileID: 0}
@@ -37,68 +38,103 @@ RenderSettings:
3738
m_ReflectionIntensity: 1
3839
m_CustomReflection: {fileID: 0}
3940
m_Sun: {fileID: 0}
40-
--- !u!127 &3
41-
LevelGameManager:
42-
m_ObjectHideFlags: 0
41+
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
42+
m_UseRadianceAmbientProbe: 0
4343
--- !u!157 &4
4444
LightmapSettings:
4545
m_ObjectHideFlags: 0
46-
serializedVersion: 5
46+
serializedVersion: 12
4747
m_GIWorkflowMode: 1
48-
m_LightmapsMode: 1
4948
m_GISettings:
5049
serializedVersion: 2
5150
m_BounceScale: 1
5251
m_IndirectOutputScale: 1
5352
m_AlbedoBoost: 1
54-
m_TemporalCoherenceThreshold: 1
5553
m_EnvironmentLightingMode: 0
5654
m_EnableBakedLightmaps: 1
5755
m_EnableRealtimeLightmaps: 0
5856
m_LightmapEditorSettings:
59-
serializedVersion: 3
57+
serializedVersion: 12
6058
m_Resolution: 1
6159
m_BakeResolution: 50
62-
m_TextureWidth: 1024
63-
m_TextureHeight: 1024
60+
m_AtlasSize: 1024
61+
m_AO: 0
6462
m_AOMaxDistance: 1
65-
m_Padding: 2
6663
m_CompAOExponent: 0
64+
m_CompAOExponentDirect: 0
65+
m_ExtractAmbientOcclusion: 0
66+
m_Padding: 2
6767
m_LightmapParameters: {fileID: 0}
68+
m_LightmapsBakeMode: 1
6869
m_TextureCompression: 0
6970
m_FinalGather: 0
71+
m_FinalGatherFiltering: 1
7072
m_FinalGatherRayCount: 1024
71-
m_LightmapSnapshot: {fileID: 0}
72-
m_RuntimeCPUUsage: 25
73+
m_ReflectionCompression: 2
74+
m_MixedBakeMode: 1
75+
m_BakeBackend: 0
76+
m_PVRSampling: 1
77+
m_PVRDirectSampleCount: 32
78+
m_PVRSampleCount: 512
79+
m_PVRBounces: 2
80+
m_PVREnvironmentSampleCount: 512
81+
m_PVREnvironmentReferencePointCount: 2048
82+
m_PVRFilteringMode: 0
83+
m_PVRDenoiserTypeDirect: 0
84+
m_PVRDenoiserTypeIndirect: 0
85+
m_PVRDenoiserTypeAO: 0
86+
m_PVRFilterTypeDirect: 0
87+
m_PVRFilterTypeIndirect: 0
88+
m_PVRFilterTypeAO: 0
89+
m_PVREnvironmentMIS: 0
90+
m_PVRCulling: 1
91+
m_PVRFilteringGaussRadiusDirect: 1
92+
m_PVRFilteringGaussRadiusIndirect: 5
93+
m_PVRFilteringGaussRadiusAO: 2
94+
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
95+
m_PVRFilteringAtrousPositionSigmaIndirect: 2
96+
m_PVRFilteringAtrousPositionSigmaAO: 1
97+
m_ExportTrainingData: 0
98+
m_TrainingDataDestination: TrainingData
99+
m_LightProbeSampleCountMultiplier: 4
100+
m_LightingDataAsset: {fileID: 0}
101+
m_LightingSettings: {fileID: 4890085278179872738, guid: 3e1d8f5fb1cba324c9e14525e9056370, type: 2}
73102
--- !u!196 &5
74103
NavMeshSettings:
75104
serializedVersion: 2
76105
m_ObjectHideFlags: 0
77106
m_BuildSettings:
78107
serializedVersion: 2
79-
agentRadius: .5
108+
agentTypeID: 0
109+
agentRadius: 0.5
80110
agentHeight: 2
81111
agentSlope: 45
82-
agentClimb: .400000006
112+
agentClimb: 0.4
83113
ledgeDropHeight: 0
84114
maxJumpAcrossDistance: 0
85-
accuratePlacement: 0
86115
minRegionArea: 2
87-
cellSize: .166666657
88116
manualCellSize: 0
117+
cellSize: 0.16666666
118+
manualTileSize: 0
119+
tileSize: 256
120+
accuratePlacement: 0
121+
maxJobWorkers: 0
122+
preserveTilesOutsideBounds: 0
123+
debug:
124+
m_Flags: 0
89125
m_NavMeshData: {fileID: 0}
90126
--- !u!1 &1154340127
91127
GameObject:
92128
m_ObjectHideFlags: 0
93-
m_PrefabParentObject: {fileID: 0}
94-
m_PrefabInternal: {fileID: 0}
95-
serializedVersion: 4
129+
m_CorrespondingSourceObject: {fileID: 0}
130+
m_PrefabInstance: {fileID: 0}
131+
m_PrefabAsset: {fileID: 0}
132+
serializedVersion: 6
96133
m_Component:
97-
- 4: {fileID: 1154340133}
98-
- 20: {fileID: 1154340132}
99-
- 92: {fileID: 1154340131}
100-
- 124: {fileID: 1154340130}
101-
- 81: {fileID: 1154340129}
134+
- component: {fileID: 1154340133}
135+
- component: {fileID: 1154340132}
136+
- component: {fileID: 1154340130}
137+
- component: {fileID: 1154340129}
102138
m_Layer: 0
103139
m_Name: Main Camera
104140
m_TagString: MainCamera
@@ -109,41 +145,43 @@ GameObject:
109145
--- !u!81 &1154340129
110146
AudioListener:
111147
m_ObjectHideFlags: 0
112-
m_PrefabParentObject: {fileID: 0}
113-
m_PrefabInternal: {fileID: 0}
148+
m_CorrespondingSourceObject: {fileID: 0}
149+
m_PrefabInstance: {fileID: 0}
150+
m_PrefabAsset: {fileID: 0}
114151
m_GameObject: {fileID: 1154340127}
115152
m_Enabled: 1
116153
--- !u!124 &1154340130
117154
Behaviour:
118155
m_ObjectHideFlags: 0
119-
m_PrefabParentObject: {fileID: 0}
120-
m_PrefabInternal: {fileID: 0}
121-
m_GameObject: {fileID: 1154340127}
122-
m_Enabled: 1
123-
--- !u!92 &1154340131
124-
Behaviour:
125-
m_ObjectHideFlags: 0
126-
m_PrefabParentObject: {fileID: 0}
127-
m_PrefabInternal: {fileID: 0}
156+
m_CorrespondingSourceObject: {fileID: 0}
157+
m_PrefabInstance: {fileID: 0}
158+
m_PrefabAsset: {fileID: 0}
128159
m_GameObject: {fileID: 1154340127}
129160
m_Enabled: 1
130161
--- !u!20 &1154340132
131162
Camera:
132163
m_ObjectHideFlags: 0
133-
m_PrefabParentObject: {fileID: 0}
134-
m_PrefabInternal: {fileID: 0}
164+
m_CorrespondingSourceObject: {fileID: 0}
165+
m_PrefabInstance: {fileID: 0}
166+
m_PrefabAsset: {fileID: 0}
135167
m_GameObject: {fileID: 1154340127}
136168
m_Enabled: 1
137169
serializedVersion: 2
138170
m_ClearFlags: 1
139-
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
171+
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
172+
m_projectionMatrixMode: 1
173+
m_GateFitMode: 2
174+
m_FOVAxisMode: 0
175+
m_SensorSize: {x: 36, y: 24}
176+
m_LensShift: {x: 0, y: 0}
177+
m_FocalLength: 50
140178
m_NormalizedViewPortRect:
141179
serializedVersion: 2
142180
x: 0
143181
y: 0
144182
width: 1
145183
height: 1
146-
near clip plane: .300000012
184+
near clip plane: 0.3
147185
far clip plane: 1000
148186
field of view: 60
149187
orthographic: 0
@@ -155,32 +193,38 @@ Camera:
155193
m_RenderingPath: -1
156194
m_TargetTexture: {fileID: 0}
157195
m_TargetDisplay: 0
196+
m_TargetEye: 3
158197
m_HDR: 0
198+
m_AllowMSAA: 1
199+
m_AllowDynamicResolution: 0
200+
m_ForceIntoRT: 0
159201
m_OcclusionCulling: 1
160202
m_StereoConvergence: 10
161-
m_StereoSeparation: .0219999999
162-
m_StereoMirrorMode: 0
203+
m_StereoSeparation: 0.022
163204
--- !u!4 &1154340133
164205
Transform:
165206
m_ObjectHideFlags: 0
166-
m_PrefabParentObject: {fileID: 0}
167-
m_PrefabInternal: {fileID: 0}
207+
m_CorrespondingSourceObject: {fileID: 0}
208+
m_PrefabInstance: {fileID: 0}
209+
m_PrefabAsset: {fileID: 0}
168210
m_GameObject: {fileID: 1154340127}
169211
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
170212
m_LocalPosition: {x: 0, y: 1, z: -10}
171213
m_LocalScale: {x: 1, y: 1, z: 1}
172214
m_Children: []
173215
m_Father: {fileID: 0}
174216
m_RootOrder: 1
217+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
175218
--- !u!1 &1816083100
176219
GameObject:
177220
m_ObjectHideFlags: 0
178-
m_PrefabParentObject: {fileID: 0}
179-
m_PrefabInternal: {fileID: 0}
180-
serializedVersion: 4
221+
m_CorrespondingSourceObject: {fileID: 0}
222+
m_PrefabInstance: {fileID: 0}
223+
m_PrefabAsset: {fileID: 0}
224+
serializedVersion: 6
181225
m_Component:
182-
- 4: {fileID: 1816083102}
183-
- 114: {fileID: 1816083101}
226+
- component: {fileID: 1816083102}
227+
- component: {fileID: 1816083101}
184228
m_Layer: 0
185229
m_Name: GameController
186230
m_TagString: Untagged
@@ -191,23 +235,28 @@ GameObject:
191235
--- !u!114 &1816083101
192236
MonoBehaviour:
193237
m_ObjectHideFlags: 0
194-
m_PrefabParentObject: {fileID: 0}
195-
m_PrefabInternal: {fileID: 0}
238+
m_CorrespondingSourceObject: {fileID: 0}
239+
m_PrefabInstance: {fileID: 0}
240+
m_PrefabAsset: {fileID: 0}
196241
m_GameObject: {fileID: 1816083100}
197242
m_Enabled: 1
198243
m_EditorHideFlags: 0
199244
m_Script: {fileID: 11500000, guid: eba598dcd24544bd28b6dd3159c13b19, type: 3}
200245
m_Name:
201246
m_EditorClassIdentifier:
247+
email: Email Address
248+
externalId: External User ID
202249
--- !u!4 &1816083102
203250
Transform:
204251
m_ObjectHideFlags: 0
205-
m_PrefabParentObject: {fileID: 0}
206-
m_PrefabInternal: {fileID: 0}
252+
m_CorrespondingSourceObject: {fileID: 0}
253+
m_PrefabInstance: {fileID: 0}
254+
m_PrefabAsset: {fileID: 0}
207255
m_GameObject: {fileID: 1816083100}
208256
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
209257
m_LocalPosition: {x: 0, y: 0, z: 0}
210258
m_LocalScale: {x: 1, y: 1, z: 1}
211259
m_Children: []
212260
m_Father: {fileID: 0}
213261
m_RootOrder: 0
262+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

0 commit comments

Comments
 (0)