Skip to content

Commit 2da24a4

Browse files
committed
Merge branch 'master' into 2022.1-urp
# Conflicts: # Packages/packages-lock.json
2 parents 2d31081 + f32965c commit 2da24a4

File tree

5 files changed

+76
-52
lines changed

5 files changed

+76
-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: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ 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+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
5656
Debug.Log($"<color=#00CCCC>{nameof(WebToolPlugins)}.{nameof(SetVariable)} set {variableName}: {value}</color>");
57+
#endif
5758
}
5859

5960
/// <summary>
@@ -63,20 +64,20 @@ public static void SetVariable(string variableName, string value)
6364
/// <param name="eventName">Name of the tracking event, e.g. "Awake"</param>
6465
public static void AddTimeTrackingEvent(string eventName)
6566
{
66-
#if UNITY_WEBGL && !UNITY_EDITOR
67+
#if UNITY_WEBGL && !UNITY_EDITOR
6768
_AddTimeTrackingEvent(eventName);
68-
#else
69+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
6970
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(AddTimeTrackingEvent)} called with {eventName}");
70-
#endif
71+
#endif
7172
}
7273

7374
public static void AddFpsTrackingEvent(float fps)
7475
{
75-
#if UNITY_WEBGL && !UNITY_EDITOR
76+
#if UNITY_WEBGL && !UNITY_EDITOR
7677
_AddFpsTrackingEvent(fps);
77-
#else
78+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
7879
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(AddFpsTrackingEvent)} called with {fps:0.00}");
79-
#endif
80+
#endif
8081
}
8182

8283
/// <summary>
@@ -87,11 +88,11 @@ public static void AddFpsTrackingEvent(float fps)
8788
public static void ShowInfoPanel()
8889
{
8990
_infoPanelVisible = true;
90-
#if UNITY_WEBGL && !UNITY_EDITOR
91+
#if UNITY_WEBGL && !UNITY_EDITOR
9192
_ShowInfoPanel();
92-
#else
93+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
9394
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(ShowInfoPanel)} called");
94-
#endif
95+
#endif
9596
}
9697

9798
/// <summary>
@@ -102,11 +103,11 @@ public static void ShowInfoPanel()
102103
public static void HideInfoPanel()
103104
{
104105
_infoPanelVisible = false;
105-
#if UNITY_WEBGL && !UNITY_EDITOR
106+
#if UNITY_WEBGL && !UNITY_EDITOR
106107
_HideInfoPanel();
107-
#else
108+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
108109
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(HideInfoPanel)} called");
109-
#endif
110+
#endif
110111
}
111112

112113
/// <summary>
@@ -130,12 +131,14 @@ public static void ToggleInfoPanel()
130131
/// <returns>navigator.userAgent</returns>
131132
public static string GetUserAgent()
132133
{
133-
#if UNITY_WEBGL && !UNITY_EDITOR
134+
#if UNITY_WEBGL && !UNITY_EDITOR
134135
return _GetUserAgent();
135-
#else
136+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
136137
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(GetUserAgent)} called");
137138
return "undefined";
138-
#endif
139+
#else
140+
return "undefined";
141+
#endif
139142
}
140143

141144
/// <summary>
@@ -157,13 +160,15 @@ public static bool IsMobileDevice()
157160
/// <returns>Size in MB</returns>
158161
public static float GetTotalMemorySize()
159162
{
160-
#if UNITY_WEBGL && !UNITY_EDITOR
163+
#if UNITY_WEBGL && !UNITY_EDITOR
161164
var bytes = _GetTotalMemorySize();
162165
return GetMegaBytes(bytes);
163-
#else
166+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
164167
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(GetTotalMemorySize)} called");
165168
return -1f;
166-
#endif
169+
#else
170+
return -1f;
171+
#endif
167172
}
168173

169174
/// <summary>
@@ -176,7 +181,7 @@ public static void LogMemory()
176181
var native = GetNativeMemorySize();
177182
var total = GetTotalMemorySize();
178183
Debug.Log($"Memory stats:\nManaged: {managed:0.00}MB\nNative: {native:0.00}MB\nTotal: {total:0.00}MB");
179-
#else
184+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
180185
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(LogMemory)} called");
181186
#endif
182187
}
@@ -187,13 +192,15 @@ public static void LogMemory()
187192
/// <returns>Size in MB</returns>
188193
public static float GetStaticMemorySize()
189194
{
190-
#if UNITY_WEBGL && !UNITY_EDITOR
195+
#if UNITY_WEBGL && !UNITY_EDITOR
191196
var bytes = _GetStaticMemorySize();
192197
return GetMegaBytes(bytes);
193-
#else
198+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
194199
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(GetStaticMemorySize)} called");
195200
return -1f;
196-
#endif
201+
#else
202+
return -1f;
203+
#endif
197204
}
198205

199206
/// <summary>
@@ -202,13 +209,15 @@ public static float GetStaticMemorySize()
202209
/// <returns>Size in MB</returns>
203210
public static float GetDynamicMemorySize()
204211
{
205-
#if UNITY_WEBGL && !UNITY_EDITOR
212+
#if UNITY_WEBGL && !UNITY_EDITOR
206213
var bytes = _GetStaticMemorySize();
207214
return GetMegaBytes(bytes);
208-
#else
215+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
209216
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(GetDynamicMemorySize)} called");
210217
return -1f;
211-
#endif
218+
#else
219+
return -1f;
220+
#endif
212221
}
213222

214223
/// <summary>
@@ -217,12 +226,14 @@ public static float GetDynamicMemorySize()
217226
/// <returns>Size in MB</returns>
218227
public static float GetNativeMemorySize()
219228
{
220-
#if UNITY_WEBGL && !UNITY_EDITOR
229+
#if UNITY_WEBGL && !UNITY_EDITOR
221230
return GetDynamicMemorySize() + GetStaticMemorySize();
222-
#else
231+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
223232
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(GetNativeMemorySize)} called");
224233
return -1f;
225-
#endif
234+
#else
235+
return -1f;
236+
#endif
226237
}
227238

228239
/// <summary>
@@ -231,7 +242,7 @@ public static float GetNativeMemorySize()
231242
/// <returns>Size in MB</returns>
232243
public static float GetManagedMemorySize()
233244
{
234-
var bytes = (uint) GC.GetTotalMemory(false);
245+
var bytes = (uint)GC.GetTotalMemory(false);
235246
return GetMegaBytes(bytes);
236247
}
237248

@@ -242,7 +253,7 @@ public static float GetManagedMemorySize()
242253
/// <returns>bytes / (1024 * 1024)</returns>
243254
private static float GetMegaBytes(uint bytes)
244255
{
245-
return (float) bytes / (1024 * 1024);
256+
return (float)bytes / (1024 * 1024);
246257
}
247258
}
248259
}

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
@@ -33,6 +33,16 @@
3333
"com.unity.modules.video": "1.0.0",
3434
"com.unity.modules.vr": "1.0.0",
3535
"com.unity.modules.wind": "1.0.0",
36-
"com.unity.modules.xr": "1.0.0"
37-
}
38-
}
36+
"com.unity.modules.xr": "1.0.0",
37+
"com.jd.guidresolver": "1.1.0"
38+
},
39+
"scopedRegistries": [
40+
{
41+
"name": "package.openupm.com",
42+
"url": "https://package.openupm.com",
43+
"scopes": [
44+
"com.jd.guidresolver"
45+
]
46+
}
47+
]
48+
}

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)