Skip to content

Commit dd1afef

Browse files
committed
Merge branch 'master' into 2022.1
# Conflicts: # ProjectSettings/ProjectVersion.txt
2 parents e7877bc + 4a328ce commit dd1afef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1062
-421
lines changed

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"visualstudiotoolsforunity.vstuc"
4+
]
5+
}

.vscode/launch.json

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,56 @@
11
{
2-
// Needed for debugging with VS Code
3-
// Use IntelliSense to learn about possible attributes.
4-
// Hover to view descriptions of existing attributes.
5-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
6-
"version": "0.2.0",
7-
"configurations": [
8-
{
9-
"name": "Unity Editor",
10-
"type": "unity",
11-
"path": "${workspaceFolder}/Library/EditorInstance.json",
12-
"request": "launch"
13-
},
14-
{
15-
"name": "Windows Player",
16-
"type": "unity",
17-
"request": "launch"
18-
},
19-
{
20-
"name": "OSX Player",
21-
"type": "unity",
22-
"request": "launch"
23-
},
24-
{
25-
"name": "Linux Player",
26-
"type": "unity",
27-
"request": "launch"
28-
},
29-
{
30-
"name": "iOS Player",
31-
"type": "unity",
32-
"request": "launch"
33-
},
34-
{
35-
"name": "Android Player",
36-
"type": "unity",
37-
"request": "launch"
38-
},
39-
{
40-
"name": "Xbox One Player",
41-
"type": "unity",
42-
"request": "launch"
43-
},
44-
{
45-
"name": "PS4 Player",
46-
"type": "unity",
47-
"request": "launch"
48-
},
49-
{
50-
"name": "SwitchPlayer",
51-
"type": "unity",
52-
"request": "launch"
53-
}
54-
]
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Unity Editor",
6+
"type": "unity",
7+
"path": "${workspaceFolder}/Library/EditorInstance.json",
8+
"request": "launch"
9+
},
10+
{
11+
"name": "Windows Player",
12+
"type": "unity",
13+
"request": "launch"
14+
},
15+
{
16+
"name": "OSX Player",
17+
"type": "unity",
18+
"request": "launch"
19+
},
20+
{
21+
"name": "Linux Player",
22+
"type": "unity",
23+
"request": "launch"
24+
},
25+
{
26+
"name": "iOS Player",
27+
"type": "unity",
28+
"request": "launch"
29+
},
30+
{
31+
"name": "Android Player",
32+
"type": "unity",
33+
"request": "launch"
34+
},
35+
{
36+
"name": "Xbox One Player",
37+
"type": "unity",
38+
"request": "launch"
39+
},
40+
{
41+
"name": "PS4 Player",
42+
"type": "unity",
43+
"request": "launch"
44+
},
45+
{
46+
"name": "SwitchPlayer",
47+
"type": "unity",
48+
"request": "launch"
49+
},
50+
{
51+
"name": "Attach to Unity",
52+
"type": "vstuc",
53+
"request": "attach"
54+
}
55+
]
5556
}

.vscode/settings.json

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
{
2-
"files.exclude":
3-
{
4-
"**/.DS_Store":true,
5-
"**/.git":true,
6-
"**/.gitmodules":true,
7-
"**/*.pidb":true,
8-
"**/*.suo":true,
9-
"**/*.user":true,
10-
"**/*.userprefs":true,
11-
"**/*.unityproj":true,
12-
"**/*.meta":true,
13-
"Library/":true,
14-
"library/":true,
15-
"obj/":true,
16-
"Obj/":true,
17-
"temp/":true,
18-
"Temp/":true
19-
}
2+
"files.exclude": {
3+
"**/.DS_Store": true,
4+
"**/.git": true,
5+
"**/.gitmodules": true,
6+
"**/*.pidb": true,
7+
"**/*.suo": true,
8+
"**/*.user": true,
9+
"**/*.userprefs": true,
10+
"**/*.unityproj": true,
11+
"**/*.meta": true,
12+
"Library/": true,
13+
"library/": true,
14+
"obj/": true,
15+
"Obj/": true,
16+
"temp/": true,
17+
"Temp/": true
18+
},
19+
"dotnet.preferCSharpExtension": true,
20+
"dotnet.defaultSolution": "UnityWebGL-LoadingTest.sln"
2021
}

Assets/Plugins/WebGL/WebBridge.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.
File renamed without changes.

Assets/Plugins/WebGL/WebGLTools/Attributes/WebGlCommandAttribute.cs renamed to Assets/Plugins/WebGL/WebBridge/Attributes/WebCommandAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Supyrb.Attributes
1515
{
1616
[AttributeUsage(AttributeTargets.Method)]
1717
[MeansImplicitUse]
18-
public class WebGlCommandAttribute : Attribute
18+
public class WebCommandAttribute : Attribute
1919
{
2020
public string Description { get; set; }
2121
}

Assets/Plugins/WebGL/WebGLTools/Attributes/WebGlCommandAttribute.cs.meta renamed to Assets/Plugins/WebGL/WebBridge/Attributes/WebCommandAttribute.cs.meta

File renamed without changes.

Assets/Plugins/WebGL/WebGLTools/WebGlBridge.Commands.cs renamed to Assets/Plugins/WebGL/WebBridge/CommonCommands.cs

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@
1616

1717
namespace Supyrb
1818
{
19-
public partial class WebGlBridge
19+
/// <summary>
20+
/// Add commands to the WebGL bridge to expose them to the browser console
21+
/// </summary>
22+
public class CommonCommands : WebCommands
2023
{
2124
/// <summary>
2225
/// Disable capturing all keyboard input, e.g. for using native html input fields
2326
/// Browser Usage: <code>unityGame.SendMessage("WebGL","DisableCaptureAllKeyboardInput");</code>
2427
/// </summary>
25-
[WebGlCommand(Description = "Disable unity from consuming all keyboard input")]
28+
[WebCommand(Description = "Disable unity from consuming all keyboard input")]
2629
public void DisableCaptureAllKeyboardInput()
2730
{
2831
#if !UNITY_EDITOR && UNITY_WEBGL
@@ -35,7 +38,7 @@ public void DisableCaptureAllKeyboardInput()
3538
/// Enable capturing all keyboard input, to make sure the game does not miss any key strokes
3639
/// Browser Usage: <code>unityGame.SendMessage("WebGL","EnableCaptureAllKeyboardInput");</code>
3740
/// </summary>
38-
[WebGlCommand(Description = "Enable unity from consuming all keyboard input")]
41+
[WebCommand(Description = "Enable unity from consuming all keyboard input")]
3942
public void EnableCaptureAllKeyboardInput()
4043
{
4144
#if !UNITY_EDITOR && UNITY_WEBGL
@@ -48,18 +51,18 @@ public void EnableCaptureAllKeyboardInput()
4851
/// Logs the current memory usage
4952
/// Browser Usage: <code>unityGame.SendMessage("WebGL","LogMemory");</code>
5053
/// </summary>
51-
[WebGlCommand(Description = "Logs the current memory")]
54+
[WebCommand(Description = "Logs the current memory")]
5255
[ContextMenu(nameof(LogMemory))]
5356
public void LogMemory()
5457
{
55-
WebGlPlugins.LogMemory();
58+
WebToolPlugins.LogMemory();
5659
}
5760

5861
/// <summary>
5962
/// Unloads all unused assets <see cref="Resources.UnloadUnusedAssets"/>
6063
/// Browser Usage: <code>unityGame.SendMessage("WebGL","UnloadUnusedAssets");</code>
6164
/// </summary>
62-
[WebGlCommand(Description = "Resources.UnloadUnusedAssets")]
65+
[WebCommand(Description = "Resources.UnloadUnusedAssets")]
6366
[ContextMenu(nameof(UnloadUnusedAssets))]
6467
public void UnloadUnusedAssets()
6568
{
@@ -72,7 +75,7 @@ public void UnloadUnusedAssets()
7275
/// Browser Usage: <code>unityGame.SendMessage("WebGL", "SetApplicationRunInBackground", 1);</code>
7376
/// </summary>
7477
/// <param name="runInBackground">1 if it should run in background</param>
75-
[WebGlCommand(Description = "Application.runInBackground")]
78+
[WebCommand(Description = "Application.runInBackground")]
7679
public void SetApplicationRunInBackground(int runInBackground)
7780
{
7881
Application.runInBackground = runInBackground == 1;
@@ -83,7 +86,7 @@ public void SetApplicationRunInBackground(int runInBackground)
8386
/// Browser Usage: <code>unityGame.SendMessage("WebGL", "SetApplicationTargetFrameRate", 15);</code>
8487
/// </summary>
8588
/// <param name="targetFrameRate">frame rate to render in</param>
86-
[WebGlCommand(Description = "Application.targetFrameRate")]
89+
[WebCommand(Description = "Application.targetFrameRate")]
8790
public void SetApplicationTargetFrameRate(int targetFrameRate)
8891
{
8992
Application.targetFrameRate = targetFrameRate;
@@ -94,7 +97,7 @@ public void SetApplicationTargetFrameRate(int targetFrameRate)
9497
/// Browser Usage: <code>unityGame.SendMessage("WebGL", "SetTimeFixedDeltaTime", 0.02);</code>
9598
/// </summary>
9699
/// <param name="fixedDeltaTime"></param>
97-
[WebGlCommand(Description = "Time.fixedDeltaTime")]
100+
[WebCommand(Description = "Time.fixedDeltaTime")]
98101
public void SetTimeFixedDeltaTime(float fixedDeltaTime)
99102
{
100103
Time.fixedDeltaTime = fixedDeltaTime;
@@ -106,7 +109,7 @@ public void SetTimeFixedDeltaTime(float fixedDeltaTime)
106109
/// Browser Usage: <code>unityGame.SendMessage("WebGL", "SetTimeTimeScale", 0.2);</code>
107110
/// </summary>
108111
/// <param name="timeScale">new timescale value</param>
109-
[WebGlCommand(Description = "Time.timeScale")]
112+
[WebCommand(Description = "Time.timeScale")]
110113
public void SetTimeTimeScale(float timeScale)
111114
{
112115
Time.timeScale = timeScale;
@@ -116,28 +119,28 @@ public void SetTimeTimeScale(float timeScale)
116119
/// Toggle the visibility of the info panel in the top right corner
117120
/// Browser Usage: <code>unityGame.SendMessage("WebGL", "ToggleInfoPanel");</code>
118121
/// </summary>
119-
[WebGlCommand(Description = "Toggle develop ui visibility of InfoPanel")]
122+
[WebCommand(Description = "Toggle develop ui visibility of InfoPanel")]
120123
public void ToggleInfoPanel()
121124
{
122-
WebGlPlugins.ToggleInfoPanel();
125+
WebToolPlugins.ToggleInfoPanel();
123126
}
124127

125128
/// <summary>
126129
/// Log the user agent of the browser and if this agent is classified as mobile
127130
/// Browser Usage: <code>unityGame.SendMessage("WebGL", "LogUserAgent");</code>
128131
/// </summary>
129-
[WebGlCommand(Description = "Log User Agent and isMobileDevice")]
132+
[WebCommand(Description = "Log User Agent and isMobileDevice")]
130133
public void LogUserAgent()
131134
{
132-
string userAgent = WebGlPlugins.GetUserAgent();
133-
bool isMobileDevice = WebGlPlugins.IsMobileDevice();
135+
string userAgent = WebToolPlugins.GetUserAgent();
136+
bool isMobileDevice = WebToolPlugins.IsMobileDevice();
134137
Debug.Log($"<color=#4D65A4>User Agent:</color> '{userAgent}', <color=#4D65A4>IsMobileDevice:</color> '{isMobileDevice}'");
135138
}
136139

137140
/// <summary>
138141
/// Log example messages to show off unity rich text parsing to html & console styling
139142
/// </summary>
140-
[WebGlCommand(Description = "Log example messages for Log, warning and error")]
143+
[WebCommand(Description = "Log example messages for Log, warning and error")]
141144
[ContextMenu(nameof(LogExampleMessages))]
142145
public void LogExampleMessages()
143146
{
@@ -150,7 +153,7 @@ public void LogExampleMessages()
150153
/// Log a custom message to test Debug.Log in general
151154
/// </summary>
152155
/// <param name="message">Message that will be logged</param>
153-
[WebGlCommand(Description = "Log a custom message")]
156+
[WebCommand(Description = "Log a custom message")]
154157
public void LogMessage(string message)
155158
{
156159
Debug.Log(message);
@@ -159,7 +162,7 @@ public void LogMessage(string message)
159162
/// <summary>
160163
/// Throw an exception from System namespace to see how stack traces look for that
161164
/// </summary>
162-
[WebGlCommand(Description = "Throw a dictionary key not found exception")]
165+
[WebCommand(Description = "Throw a dictionary key not found exception")]
163166
[ContextMenu(nameof(ThrowDictionaryException))]
164167
public void ThrowDictionaryException()
165168
{
@@ -172,7 +175,7 @@ public void ThrowDictionaryException()
172175
/// Log information of all texture formats that Unity supports, which ones are supported by
173176
/// the current platform and browser, and which ones are not supported
174177
/// </summary>
175-
[WebGlCommand(Description = "Log supported and unsupported texture formats")]
178+
[WebCommand(Description = "Log supported and unsupported texture formats")]
176179
[ContextMenu(nameof(LogTextureSupport))]
177180
public void LogTextureSupport()
178181
{
@@ -206,7 +209,7 @@ public void LogTextureSupport()
206209
/// <summary>
207210
/// Deletes all player prefs <see cref="PlayerPrefs.DeleteAll"/>
208211
/// </summary>
209-
[WebGlCommand(Description = "PlayerPrefs.DeleteAll")]
212+
[WebCommand(Description = "PlayerPrefs.DeleteAll")]
210213
[ContextMenu(nameof(DeleteAllPlayerPrefs))]
211214
public void DeleteAllPlayerPrefs()
212215
{
@@ -218,7 +221,7 @@ public void DeleteAllPlayerPrefs()
218221
/// <see cref="GraphicsSettings.logWhenShaderIsCompiled "/>
219222
/// </summary>
220223
/// <param name="runInBackground">1 if it should run in background</param>
221-
[WebGlCommand(Description = "GraphicsSettings.logWhenShaderIsCompiled")]
224+
[WebCommand(Description = "GraphicsSettings.logWhenShaderIsCompiled")]
222225
[ContextMenu(nameof(LogShaderCompilation))]
223226
public void LogShaderCompilation(int enabled)
224227
{

Assets/Plugins/WebGL/WebGLTools/WebGlBridge.Commands.cs.meta renamed to Assets/Plugins/WebGL/WebBridge/CommonCommands.cs.meta

File renamed without changes.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "Supyrb.WebBridge",
3+
"rootNamespace": "",
4+
"references": [
5+
"GUID:e6be6bd2cac63ce49a95472c9d6e313a"
6+
],
7+
"includePlatforms": [
8+
"Editor",
9+
"WebGL"
10+
],
11+
"excludePlatforms": [],
12+
"allowUnsafeCode": false,
13+
"overrideReferences": false,
14+
"precompiledReferences": [],
15+
"autoReferenced": true,
16+
"defineConstraints": [],
17+
"versionDefines": [],
18+
"noEngineReferences": false
19+
}

0 commit comments

Comments
 (0)