Skip to content

Commit 3ca5623

Browse files
committed
Merge branch 'master' into 2022.3
2 parents 56d882a + a055cc8 commit 3ca5623

File tree

6 files changed

+83
-52
lines changed

6 files changed

+83
-52
lines changed

Assets/Plugins/WebGL/WebBridge/WebBridge.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ private static void SetGlobalVariables()
9292

9393
private void Start()
9494
{
95+
#if (!UNITY_EDITOR && UNITY_WEBGL) || UNITY_EDITOR && WEBTOOLS_LOG_CALLS
9596
Debug.Log($"Unity WebGL Bridge ready -> Run 'runUnityCommand(\"Help\")' in the browser console to see usage");
97+
#endif
9698
}
9799

98100
[WebCommand(Description = "Log all available commands")]

Assets/Plugins/WebGL/WebTools/WebToolPlugins.cs

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ public static class WebToolPlugins
5050
/// <param name="value">Value of the variable</param>
5151
public static void SetVariable(string variableName, string value)
5252
{
53-
#if UNITY_WEBGL && !UNITY_EDITOR
53+
#if UNITY_WEBGL && !UNITY_EDITOR
5454
_SetStringVariable(variableName, value);
55-
#endif
55+
_AddTimeTrackingEvent(eventName);
56+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
5657
Debug.Log($"<color=#00CCCC>{nameof(WebToolPlugins)}.{nameof(SetVariable)} set {variableName}: {value}</color>");
58+
#endif
5759
}
5860

5961
/// <summary>
@@ -63,20 +65,20 @@ public static void SetVariable(string variableName, string value)
6365
/// <param name="eventName">Name of the tracking event, e.g. "Awake"</param>
6466
public static void AddTimeTrackingEvent(string eventName)
6567
{
66-
#if UNITY_WEBGL && !UNITY_EDITOR
68+
#if UNITY_WEBGL && !UNITY_EDITOR
6769
_AddTimeTrackingEvent(eventName);
68-
#else
70+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
6971
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(AddTimeTrackingEvent)} called with {eventName}");
70-
#endif
72+
#endif
7173
}
7274

7375
public static void AddFpsTrackingEvent(float fps)
7476
{
75-
#if UNITY_WEBGL && !UNITY_EDITOR
77+
#if UNITY_WEBGL && !UNITY_EDITOR
7678
_AddFpsTrackingEvent(fps);
77-
#else
79+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
7880
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(AddFpsTrackingEvent)} called with {fps:0.00}");
79-
#endif
81+
#endif
8082
}
8183

8284
/// <summary>
@@ -87,11 +89,11 @@ public static void AddFpsTrackingEvent(float fps)
8789
public static void ShowInfoPanel()
8890
{
8991
_infoPanelVisible = true;
90-
#if UNITY_WEBGL && !UNITY_EDITOR
92+
#if UNITY_WEBGL && !UNITY_EDITOR
9193
_ShowInfoPanel();
92-
#else
94+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
9395
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(ShowInfoPanel)} called");
94-
#endif
96+
#endif
9597
}
9698

9799
/// <summary>
@@ -102,11 +104,11 @@ public static void ShowInfoPanel()
102104
public static void HideInfoPanel()
103105
{
104106
_infoPanelVisible = false;
105-
#if UNITY_WEBGL && !UNITY_EDITOR
107+
#if UNITY_WEBGL && !UNITY_EDITOR
106108
_HideInfoPanel();
107-
#else
109+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
108110
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(HideInfoPanel)} called");
109-
#endif
111+
#endif
110112
}
111113

112114
/// <summary>
@@ -130,12 +132,12 @@ public static void ToggleInfoPanel()
130132
/// <returns>navigator.userAgent</returns>
131133
public static string GetUserAgent()
132134
{
133-
#if UNITY_WEBGL && !UNITY_EDITOR
135+
#if UNITY_WEBGL && !UNITY_EDITOR
134136
return _GetUserAgent();
135-
#else
137+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
136138
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(GetUserAgent)} called");
139+
#endif
137140
return "undefined";
138-
#endif
139141
}
140142

141143
/// <summary>
@@ -157,13 +159,13 @@ public static bool IsMobileDevice()
157159
/// <returns>Size in MB</returns>
158160
public static float GetTotalMemorySize()
159161
{
160-
#if UNITY_WEBGL && !UNITY_EDITOR
162+
#if UNITY_WEBGL && !UNITY_EDITOR
161163
var bytes = _GetTotalMemorySize();
162164
return GetMegaBytes(bytes);
163-
#else
165+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
164166
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(GetTotalMemorySize)} called");
167+
#endif
165168
return -1f;
166-
#endif
167169
}
168170

169171
/// <summary>
@@ -176,7 +178,7 @@ public static void LogMemory()
176178
var native = GetNativeMemorySize();
177179
var total = GetTotalMemorySize();
178180
Debug.Log($"Memory stats:\nManaged: {managed:0.00}MB\nNative: {native:0.00}MB\nTotal: {total:0.00}MB");
179-
#else
181+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
180182
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(LogMemory)} called");
181183
#endif
182184
}
@@ -187,13 +189,13 @@ public static void LogMemory()
187189
/// <returns>Size in MB</returns>
188190
public static float GetStaticMemorySize()
189191
{
190-
#if UNITY_WEBGL && !UNITY_EDITOR
192+
#if UNITY_WEBGL && !UNITY_EDITOR
191193
var bytes = _GetStaticMemorySize();
192194
return GetMegaBytes(bytes);
193-
#else
195+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
194196
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(GetStaticMemorySize)} called");
197+
#endif
195198
return -1f;
196-
#endif
197199
}
198200

199201
/// <summary>
@@ -202,13 +204,13 @@ public static float GetStaticMemorySize()
202204
/// <returns>Size in MB</returns>
203205
public static float GetDynamicMemorySize()
204206
{
205-
#if UNITY_WEBGL && !UNITY_EDITOR
207+
#if UNITY_WEBGL && !UNITY_EDITOR
206208
var bytes = _GetStaticMemorySize();
207209
return GetMegaBytes(bytes);
208-
#else
210+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
209211
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(GetDynamicMemorySize)} called");
212+
#endif
210213
return -1f;
211-
#endif
212214
}
213215

214216
/// <summary>
@@ -217,12 +219,12 @@ public static float GetDynamicMemorySize()
217219
/// <returns>Size in MB</returns>
218220
public static float GetNativeMemorySize()
219221
{
220-
#if UNITY_WEBGL && !UNITY_EDITOR
222+
#if UNITY_WEBGL && !UNITY_EDITOR
221223
return GetDynamicMemorySize() + GetStaticMemorySize();
222-
#else
224+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
223225
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(GetNativeMemorySize)} called");
226+
#endif
224227
return -1f;
225-
#endif
226228
}
227229

228230
/// <summary>
@@ -231,7 +233,7 @@ public static float GetNativeMemorySize()
231233
/// <returns>Size in MB</returns>
232234
public static float GetManagedMemorySize()
233235
{
234-
var bytes = (uint) GC.GetTotalMemory(false);
236+
var bytes = (uint)GC.GetTotalMemory(false);
235237
return GetMegaBytes(bytes);
236238
}
237239

@@ -242,7 +244,7 @@ public static float GetManagedMemorySize()
242244
/// <returns>bytes / (1024 * 1024)</returns>
243245
private static float GetMegaBytes(uint bytes)
244246
{
245-
return (float) bytes / (1024 * 1024);
247+
return (float)bytes / (1024 * 1024);
246248
}
247249
}
248250
}

Assets/WebGLTemplates/Release/pretty-console.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function setupConsoleLogPipe() {
1414
console.info = (message) => { handleLog(message, 'info', defaultConsoleInfo); };
1515
console.debug = (message) => { handleLog(message, 'debug', defaultConsoleDebug); };
1616
console.warn = (message) => { handleLog(message, 'warn', defaultConsoleWarn); };
17-
console.error = (message) => { handleLog(message, 'error', defaultConsoleError); errorReceived(); };
17+
console.error = (message) => { handleLog(message, 'error', defaultConsoleError); };
1818

1919

2020
handleLog = (message, logLevel, consoleLogFunction) => {

Packages/manifest.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@
3232
"com.unity.modules.video": "1.0.0",
3333
"com.unity.modules.vr": "1.0.0",
3434
"com.unity.modules.wind": "1.0.0",
35-
"com.unity.modules.xr": "1.0.0"
36-
}
37-
}
35+
"com.unity.modules.xr": "1.0.0",
36+
"com.jd.guidresolver": "1.1.0"
37+
},
38+
"scopedRegistries": [
39+
{
40+
"name": "package.openupm.com",
41+
"url": "https://package.openupm.com",
42+
"scopes": [
43+
"com.jd.guidresolver"
44+
]
45+
}
46+
]
47+
}

Packages/packages-lock.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
{
22
"dependencies": {
3+
"com.jd.guidresolver": {
4+
"version": "1.1.0",
5+
"depth": 0,
6+
"source": "registry",
7+
"dependencies": {
8+
"com.unity.nuget.newtonsoft-json": "3.0.2"
9+
},
10+
"url": "https://package.openupm.com"
11+
},
312
"com.unity.ai.navigation": {
413
"version": "1.1.5",
514
"depth": 0,
@@ -58,6 +67,13 @@
5867
"dependencies": {},
5968
"url": "https://packages.unity.com"
6069
},
70+
"com.unity.nuget.newtonsoft-json": {
71+
"version": "3.2.1",
72+
"depth": 1,
73+
"source": "registry",
74+
"dependencies": {},
75+
"url": "https://packages.unity.com"
76+
},
6177
"com.unity.settings-manager": {
6278
"version": "2.0.1",
6379
"depth": 1,

ProjectSettings/PackageManagerSettings.asset

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ MonoBehaviour:
1212
m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
1313
m_Name:
1414
m_EditorClassIdentifier:
15-
m_EnablePreviewPackages: 0
16-
m_EnablePackageDependencies: 0
15+
m_EnablePreReleasePackages: 0
1716
m_AdvancedSettingsExpanded: 1
1817
m_ScopedRegistriesSettingsExpanded: 1
18+
m_SeeAllPackageVersions: 0
19+
m_DismissPreviewPackagesInUse: 0
1920
oneTimeWarningShown: 0
2021
m_Registries:
2122
- m_Id: main
@@ -24,20 +25,20 @@ MonoBehaviour:
2425
m_Scopes: []
2526
m_IsDefault: 1
2627
m_Capabilities: 7
27-
m_UserSelectedRegistryName:
28+
m_ConfigSource: 0
29+
- m_Id: scoped:project:package.openupm.com
30+
m_Name: package.openupm.com
31+
m_Url: https://package.openupm.com
32+
m_Scopes:
33+
- com.jd.guidresolver
34+
m_IsDefault: 0
35+
m_Capabilities: 0
36+
m_ConfigSource: 4
37+
m_UserSelectedRegistryName: package.openupm.com
2838
m_UserAddingNewScopedRegistry: 0
2939
m_RegistryInfoDraft:
30-
m_ErrorMessage:
31-
m_Original:
32-
m_Id:
33-
m_Name:
34-
m_Url:
35-
m_Scopes: []
36-
m_IsDefault: 0
37-
m_Capabilities: 0
3840
m_Modified: 0
39-
m_Name:
40-
m_Url:
41-
m_Scopes:
42-
-
43-
m_SelectedScopeIndex: 0
41+
m_ErrorMessage:
42+
m_UserModificationsInstanceId: -834
43+
m_OriginalInstanceId: -836
44+
m_LoadAssets: 0

0 commit comments

Comments
 (0)