Skip to content

Commit 48de666

Browse files
committed
Merge branch 'master' into 2022.2
2 parents 78153c6 + af9c3d9 commit 48de666

File tree

7 files changed

+139
-8
lines changed

7 files changed

+139
-8
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## [Automated Workflow] Upgrade unity to {{ .unityversion }}
2+
3+
> [workflow file](https://github.com/JohannesDeml/UnityWebGL-LoadingTest/blob/master/.github/workflows/upgrade-unity.yml) using [create-pull-request](https://github.com/peter-evans/create-pull-request) & [render-template](https://github.com/chuhlomin/render-template)
4+
5+
### Built version demos
6+
7+
* https://deml.io/experiments/unity-webgl/{{ .unityversion }}-webgl2
8+
* https://deml.io/experiments/unity-webgl/{{ .unityversion }}-webgl1
9+
10+
### Other links
11+
12+
* [All builds](https://deml.io/experiments/unity-webgl)
13+
* [Game CI docker images](https://game.ci/docs/docker/versions)
14+
* [Unity Download Archive](https://unity.com/releases/editor/archive)

.github/workflows/upgrade-unity.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Manually upgrade unity and update packages
2+
# Check if the Unity version already exists as a docker image: https://game.ci/docs/docker/versions
23
name: Upgrade Unity version
34

45
on:
@@ -117,14 +118,23 @@ jobs:
117118
GIT_USER: ${{ github.actor }}
118119

119120

121+
- name: Render template
122+
id: template
123+
uses: chuhlomin/render-template@v1.4
124+
with:
125+
template: .github/templates/upgrade-unity-pr-body.md
126+
vars: |
127+
unityversion: ${{ steps.upgrade_name.outputs.NAME }}
128+
120129
- name: Create Pull Request
121130
uses: peter-evans/create-pull-request@v4
122131
with:
123132
token: ${{ secrets.PR_GITHUB_TOKEN }}
124133
commit-message: "[Automated workflow] upgrade-unity from ${{steps.last_unity_version.outputs.VERSION}} to ${{ inputs.unityVersion }}"
125134
branch: "ci/upgrade-unity/from-${{steps.last_unity_version.outputs.VERSION}}-to-${{ steps.upgrade_name.outputs.NAME }}"
126135
delete-branch: true
127-
title: "[Automated workflow] upgrade-unity from ${{steps.last_unity_version.outputs.VERSION}} to ${{ inputs.unityVersion }} - URP: ${{ inputs.urp }}"
136+
title: "[Automated workflow] upgrade-unity from ${{steps.last_unity_version.outputs.VERSION}} to ${{ steps.upgrade_name.outputs.NAME }}"
137+
body: ${{ steps.template.outputs.result }}
128138

129139
- name: Add tags
130140
run: |

Assets/Plugins/WebGL/WebGLTools/WebGlBridge.Commands.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// </author>
99
// --------------------------------------------------------------------------------------------------------------------
1010

11+
using System;
12+
using System.Collections.Generic;
1113
using Supyrb.Attributes;
1214
using UnityEngine;
1315

@@ -125,5 +127,39 @@ public void LogMessage(string message)
125127
{
126128
Debug.Log(message);
127129
}
130+
131+
/// <summary>
132+
/// Log information of all texture formats that Unity supports, which ones are supported by
133+
/// the current platform and browser, and which ones are not supported
134+
/// </summary>
135+
[WebGlCommand(Description = "Log supported and unsupported texture formats")]
136+
public void LogTextureSupport()
137+
{
138+
List<TextureFormat> supportedFormats = new List<TextureFormat>();
139+
List<TextureFormat> unsupportedFormats = new List<TextureFormat>();
140+
141+
foreach (TextureFormat textureFormat in Enum.GetValues(typeof(TextureFormat)))
142+
{
143+
var memberInfos = typeof(TextureFormat).GetMember(textureFormat.ToString());
144+
object[] obsoleteAttributes = memberInfos[0].GetCustomAttributes(typeof(ObsoleteAttribute), false);
145+
if (obsoleteAttributes.Length > 0)
146+
{
147+
// don't evaluate obsolete enum values
148+
continue;
149+
}
150+
151+
if (SystemInfo.SupportsTextureFormat(textureFormat))
152+
{
153+
supportedFormats.Add(textureFormat);
154+
}
155+
else
156+
{
157+
unsupportedFormats.Add(textureFormat);
158+
}
159+
}
160+
161+
Debug.Log($"Supported Texture formats: \n{string.Join(", ", supportedFormats)}");
162+
Debug.Log($"Unsupported Texture formats: \n{string.Join(", ", unsupportedFormats)}");
163+
}
128164
}
129165
}

Assets/WebGLTemplates/Develop/debug-console.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@
6868
content: '🛑';
6969
}
7070

71+
#debugConsole .console-top-bar .timestamp-button .icon::before {
72+
content: '🕰️';
73+
}
74+
7175
#debugConsole .console-top-bar .separator {
7276
position: relative;
7377
flex-shrink: 0;
@@ -107,6 +111,14 @@
107111
display:none;
108112
}
109113

114+
#debugConsole .timestamplog {
115+
color: #888;
116+
}
117+
118+
#debugConsole.hidelogtimestamps .timestamplog {
119+
display: none;
120+
}
121+
110122
#debugConsole .entry.warn {
111123
color: rgb(82, 70, 3);
112124
background-color: rgba(231, 196, 41, 0.9);
@@ -131,6 +143,10 @@
131143
border-bottom: 3px solid yellowgreen;
132144
}
133145

146+
#debugConsole .timestamp-button.show {
147+
border-bottom: 3px solid yellowgreen;
148+
}
149+
134150
#debugConsole .bubble-click-indicator:before {
135151
content: attr(data-before);
136152
;

Assets/WebGLTemplates/Develop/debug-console.js

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ function getCookie(cname) {
3131
return "";
3232
}
3333

34-
var scrollToBottom = false; // Default to false, since continuous erros can overload the system
35-
if(getCookie("scrollToBottom") === "true") {
36-
scrollToBottom = true;
34+
var scrollToBottom = true;
35+
if(getCookie("scrollToBottom") === "false") {
36+
scrollToBottom = false;
37+
}
38+
var addTimestamp = true;
39+
if(getCookie("addTimestamp") === "false") {
40+
addTimestamp = false;
3741
}
3842

3943
function initialzeDebugConsole() {
@@ -74,6 +78,28 @@ function addDebugConsoleTopBar(debugConsole, consoleDiv) {
7478
separator.classList.add('separator');
7579
consoleTopBar.appendChild(separator);
7680

81+
// Add timestamp toggle
82+
var timestampButton = document.createElement('button');
83+
timestampButton.classList.add('timestamp-button', 'bubble-click-indicator');
84+
timestampButton.title = 'Add timestamp to logs';
85+
consoleTopBar.appendChild(timestampButton);
86+
87+
var timestampIcon = document.createElement('div');
88+
timestampIcon.classList.add('icon');
89+
timestampButton.appendChild(timestampIcon);
90+
applyTimestamp(timestampButton, consoleDiv);
91+
92+
timestampButton.addEventListener('click', function () {
93+
addTimestamp = !addTimestamp;
94+
setCookie("addTimestamp", addTimestamp, 365);
95+
applyTimestamp(timestampButton, consoleDiv);
96+
// Show copy feedback to the user
97+
timestampButton.classList.add('active');
98+
setTimeout(function () {
99+
timestampButton.classList.remove('active');
100+
}, 1500);
101+
});
102+
77103
// Clear logs button
78104
var clearButton = document.createElement('button');
79105
clearButton.classList.add('clear-button', 'bubble-click-indicator');
@@ -207,6 +233,18 @@ function applyScrollToBottom(toBottomButton, consoleDiv) {
207233
}
208234
}
209235

236+
function applyTimestamp(timestampButton, consoleDiv) {
237+
timestampButton.setAttribute('data-before', addTimestamp ? 'Show' : 'Hide');
238+
var debugConsole = document.getElementById('debugConsole');
239+
if (addTimestamp) {
240+
timestampButton.classList.add("show");
241+
debugConsole.classList.remove("hidelogtimestamps");
242+
} else {
243+
timestampButton.classList.remove("show");
244+
debugConsole.classList.add("hidelogtimestamps");
245+
}
246+
}
247+
210248
function setupConsoleLogPipe() {
211249
// Store actual console log functions
212250
let defaultConsoleLog = console.log;
@@ -293,10 +331,13 @@ function htmlLog(message, className) {
293331
consoleDiv.appendChild(entry);
294332

295333
var text = document.createElement('p');
296-
// Remove last line break if existing
297-
if (message.endsWith("\n")) {
298-
message = message.substring(0, message.length - "\n".length);
299-
}
334+
var time = new Date().toLocaleTimeString('en-US', {
335+
hour12: false,
336+
hour: "numeric",
337+
minute: "numeric",
338+
second: "numeric"}
339+
);
340+
message = "<span class='timestamplog'>[" + time + "] </span>" + message;
300341
message = message.replaceAll("\n", "<br />");
301342
text.innerHTML = message;
302343
entry.appendChild(text);

Assets/WebGLTemplates/Develop/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,15 @@
1111
margin: 0;
1212
}
1313

14+
html {
15+
/* fix mobile viewport menu bar on iOS */
16+
height: -webkit-fill-available;
17+
}
18+
1419
body {
1520
height: 100%;
21+
/* fix mobile viewport menu bar on iOS */
22+
height: -webkit-fill-available;
1623
width: 100%;
1724
text-align: center;
1825
}

Assets/WebGLTemplates/Release/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,15 @@
1111
margin: 0;
1212
}
1313

14+
html {
15+
/* fix mobile viewport menu bar on iOS */
16+
height: -webkit-fill-available;
17+
}
18+
1419
body {
1520
height: 100%;
21+
/* fix mobile viewport menu bar on iOS */
22+
height: -webkit-fill-available;
1623
width: 100%;
1724
text-align: center;
1825
}

0 commit comments

Comments
 (0)