Skip to content

Commit 80d6e29

Browse files
Create WebGL builds
1 parent f76f00b commit 80d6e29

File tree

977 files changed

+204466
-13
lines changed

Some content is hidden

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

977 files changed

+204466
-13
lines changed

.github/workflows/static.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy WebGL Builds to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["main"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
jobs:
25+
# Single deploy job since we're just deploying
26+
deploy:
27+
environment:
28+
name: github-pages
29+
url: ${{ steps.deployment.outputs.page_url }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
- name: Setup Pages
35+
uses: actions/configure-pages@v4
36+
- name: Upload artifact
37+
uses: actions/upload-pages-artifact@v3
38+
with:
39+
# Upload entire repository
40+
path: './Builds'
41+
- name: Deploy to GitHub Pages
42+
id: deployment
43+
uses: actions/deploy-pages@v4

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
/[Ll]ibrary/
66
/[Tt]emp/
77
/[Oo]bj/
8-
/[Bb]uild/
9-
/[Bb]uilds/
108
/[Ll]ogs/
119
/[Uu]ser[Ss]ettings/
1210

7.09 MB
Binary file not shown.

Builds/Challenge1/Build/Challenge1.framework.js

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Builds/Challenge1/Build/Challenge1.loader.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
16.1 MB
Binary file not shown.
2.25 KB
Binary file not shown.
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
body { padding: 0; margin: 0 }
2+
#unity-container { position: absolute }
3+
#unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
4+
#unity-container.unity-mobile { width: 100%; height: 100% }
5+
#unity-canvas { background: #231F20 }
6+
.unity-mobile #unity-canvas { width: 100%; height: 100% }
7+
#unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
8+
#unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
9+
#unity-progress-bar-empty { width: 141px; height: 18px; margin-top: 10px; margin-left: 6.5px; background: url('progress-bar-empty-dark.png') no-repeat center }
10+
#unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
11+
#unity-footer { position: relative }
12+
.unity-mobile #unity-footer { display: none }
13+
#unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
14+
#unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
15+
#unity-fullscreen-button { float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
16+
#unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }
2.88 KB

Builds/Challenge1/index.html

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<!DOCTYPE html>
2+
<html lang="en-us">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6+
<title>Unity WebGL Player | Prototype 1</title>
7+
<link rel="shortcut icon" href="TemplateData/favicon.ico">
8+
<link rel="stylesheet" href="TemplateData/style.css">
9+
</head>
10+
<body>
11+
<div id="unity-container" class="unity-desktop">
12+
<canvas id="unity-canvas" width=960 height=600></canvas>
13+
<div id="unity-loading-bar">
14+
<div id="unity-logo"></div>
15+
<div id="unity-progress-bar-empty">
16+
<div id="unity-progress-bar-full"></div>
17+
</div>
18+
</div>
19+
<div id="unity-warning"> </div>
20+
<div id="unity-footer">
21+
<div id="unity-webgl-logo"></div>
22+
<div id="unity-fullscreen-button"></div>
23+
<div id="unity-build-title">Prototype 1</div>
24+
</div>
25+
</div>
26+
<script>
27+
var container = document.querySelector("#unity-container");
28+
var canvas = document.querySelector("#unity-canvas");
29+
var loadingBar = document.querySelector("#unity-loading-bar");
30+
var progressBarFull = document.querySelector("#unity-progress-bar-full");
31+
var fullscreenButton = document.querySelector("#unity-fullscreen-button");
32+
var warningBanner = document.querySelector("#unity-warning");
33+
34+
// Shows a temporary message banner/ribbon for a few seconds, or
35+
// a permanent error message on top of the canvas if type=='error'.
36+
// If type=='warning', a yellow highlight color is used.
37+
// Modify or remove this function to customize the visually presented
38+
// way that non-critical warnings and error messages are presented to the
39+
// user.
40+
function unityShowBanner(msg, type) {
41+
function updateBannerVisibility() {
42+
warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
43+
}
44+
var div = document.createElement('div');
45+
div.innerHTML = msg;
46+
warningBanner.appendChild(div);
47+
if (type == 'error') div.style = 'background: red; padding: 10px;';
48+
else {
49+
if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
50+
setTimeout(function() {
51+
warningBanner.removeChild(div);
52+
updateBannerVisibility();
53+
}, 5000);
54+
}
55+
updateBannerVisibility();
56+
}
57+
58+
var buildUrl = "Build";
59+
var loaderUrl = buildUrl + "/Challenge1.loader.js";
60+
var config = {
61+
dataUrl: buildUrl + "/Challenge1.data",
62+
frameworkUrl: buildUrl + "/Challenge1.framework.js",
63+
codeUrl: buildUrl + "/Challenge1.wasm",
64+
streamingAssetsUrl: "StreamingAssets",
65+
companyName: "DefaultCompany",
66+
productName: "Prototype 1",
67+
productVersion: "0.1",
68+
showBanner: unityShowBanner,
69+
};
70+
71+
// By default, Unity keeps WebGL canvas render target size matched with
72+
// the DOM size of the canvas element (scaled by window.devicePixelRatio)
73+
// Set this to false if you want to decouple this synchronization from
74+
// happening inside the engine, and you would instead like to size up
75+
// the canvas DOM size and WebGL render target sizes yourself.
76+
// config.matchWebGLToCanvasSize = false;
77+
78+
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
79+
// Mobile device style: fill the whole browser client area with the game canvas:
80+
81+
var meta = document.createElement('meta');
82+
meta.name = 'viewport';
83+
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
84+
document.getElementsByTagName('head')[0].appendChild(meta);
85+
container.className = "unity-mobile";
86+
canvas.className = "unity-mobile";
87+
88+
// To lower canvas resolution on mobile devices to gain some
89+
// performance, uncomment the following line:
90+
// config.devicePixelRatio = 1;
91+
92+
unityShowBanner('WebGL builds are not supported on mobile devices.');
93+
} else {
94+
// Desktop style: Render the game canvas in a window that can be maximized to fullscreen:
95+
96+
canvas.style.width = "960px";
97+
canvas.style.height = "600px";
98+
}
99+
100+
loadingBar.style.display = "block";
101+
102+
var script = document.createElement("script");
103+
script.src = loaderUrl;
104+
script.onload = () => {
105+
createUnityInstance(canvas, config, (progress) => {
106+
progressBarFull.style.width = 100 * progress + "%";
107+
}).then((unityInstance) => {
108+
loadingBar.style.display = "none";
109+
fullscreenButton.onclick = () => {
110+
unityInstance.SetFullscreen(1);
111+
};
112+
}).catch((message) => {
113+
alert(message);
114+
});
115+
};
116+
document.body.appendChild(script);
117+
</script>
118+
</body>
119+
</html>
7.41 MB
Binary file not shown.

Builds/Challenge2/Build/Challenge2.framework.js

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Builds/Challenge2/Build/Challenge2.loader.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
10.3 MB
Binary file not shown.

Builds/Challenge2/GUID.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f6979747a0393cc499c145f41f03246e

Builds/Challenge2/ProjectVersion.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
m_EditorVersion: 2021.3.31f1
2+
m_EditorVersionWithRevision: 2021.3.31f1 (3409e2af086f)
2.25 KB
Binary file not shown.
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
body { padding: 0; margin: 0 }
2+
#unity-container { position: absolute }
3+
#unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
4+
#unity-container.unity-mobile { width: 100%; height: 100% }
5+
#unity-canvas { background: #231F20 }
6+
.unity-mobile #unity-canvas { width: 100%; height: 100% }
7+
#unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
8+
#unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
9+
#unity-progress-bar-empty { width: 141px; height: 18px; margin-top: 10px; margin-left: 6.5px; background: url('progress-bar-empty-dark.png') no-repeat center }
10+
#unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
11+
#unity-footer { position: relative }
12+
.unity-mobile #unity-footer { display: none }
13+
#unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
14+
#unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
15+
#unity-fullscreen-button { float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
16+
#unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }
2.88 KB

Builds/Challenge2/dependencies.txt

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
com.unity.collab-proxy@2.1.0
2+
com.unity.connect.share@4.2.3
3+
com.unity.feature.development@1.0.1
4+
com.unity.ide.rider@3.0.25
5+
com.unity.ide.visualstudio@2.0.21
6+
com.unity.ide.vscode@1.2.5
7+
com.unity.test-framework@1.1.33
8+
com.unity.textmeshpro@3.0.6
9+
com.unity.timeline@1.6.5
10+
com.unity.ugui@1.0.0
11+
com.unity.visualscripting@1.9.1
12+
com.unity.modules.ai@1.0.0
13+
com.unity.modules.androidjni@1.0.0
14+
com.unity.modules.animation@1.0.0
15+
com.unity.modules.assetbundle@1.0.0
16+
com.unity.modules.audio@1.0.0
17+
com.unity.modules.cloth@1.0.0
18+
com.unity.modules.director@1.0.0
19+
com.unity.modules.imageconversion@1.0.0
20+
com.unity.modules.imgui@1.0.0
21+
com.unity.modules.jsonserialize@1.0.0
22+
com.unity.modules.particlesystem@1.0.0
23+
com.unity.modules.physics@1.0.0
24+
com.unity.modules.physics2d@1.0.0
25+
com.unity.modules.screencapture@1.0.0
26+
com.unity.modules.terrain@1.0.0
27+
com.unity.modules.terrainphysics@1.0.0
28+
com.unity.modules.tilemap@1.0.0
29+
com.unity.modules.ui@1.0.0
30+
com.unity.modules.uielements@1.0.0
31+
com.unity.modules.umbra@1.0.0
32+
com.unity.modules.unityanalytics@1.0.0
33+
com.unity.modules.unitywebrequest@1.0.0
34+
com.unity.modules.unitywebrequestassetbundle@1.0.0
35+
com.unity.modules.unitywebrequestaudio@1.0.0
36+
com.unity.modules.unitywebrequesttexture@1.0.0
37+
com.unity.modules.unitywebrequestwww@1.0.0
38+
com.unity.modules.vehicles@1.0.0
39+
com.unity.modules.video@1.0.0
40+
com.unity.modules.vr@1.0.0
41+
com.unity.modules.wind@1.0.0
42+
com.unity.modules.xr@1.0.0
43+
com.unity.template.3d@8.1.3

Builds/Challenge2/index.html

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<!DOCTYPE html>
2+
<html lang="en-us">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6+
<title>Unity WebGL Player | Challenge 2</title>
7+
<link rel="shortcut icon" href="TemplateData/favicon.ico">
8+
<link rel="stylesheet" href="TemplateData/style.css">
9+
</head>
10+
<body>
11+
<div id="unity-container" class="unity-desktop">
12+
<canvas id="unity-canvas" width=960 height=600></canvas>
13+
<div id="unity-loading-bar">
14+
<div id="unity-logo"></div>
15+
<div id="unity-progress-bar-empty">
16+
<div id="unity-progress-bar-full"></div>
17+
</div>
18+
</div>
19+
<div id="unity-warning"> </div>
20+
<div id="unity-footer">
21+
<div id="unity-webgl-logo"></div>
22+
<div id="unity-fullscreen-button"></div>
23+
<div id="unity-build-title">Challenge 2</div>
24+
</div>
25+
</div>
26+
<script>
27+
var container = document.querySelector("#unity-container");
28+
var canvas = document.querySelector("#unity-canvas");
29+
var loadingBar = document.querySelector("#unity-loading-bar");
30+
var progressBarFull = document.querySelector("#unity-progress-bar-full");
31+
var fullscreenButton = document.querySelector("#unity-fullscreen-button");
32+
var warningBanner = document.querySelector("#unity-warning");
33+
34+
// Shows a temporary message banner/ribbon for a few seconds, or
35+
// a permanent error message on top of the canvas if type=='error'.
36+
// If type=='warning', a yellow highlight color is used.
37+
// Modify or remove this function to customize the visually presented
38+
// way that non-critical warnings and error messages are presented to the
39+
// user.
40+
function unityShowBanner(msg, type) {
41+
function updateBannerVisibility() {
42+
warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
43+
}
44+
var div = document.createElement('div');
45+
div.innerHTML = msg;
46+
warningBanner.appendChild(div);
47+
if (type == 'error') div.style = 'background: red; padding: 10px;';
48+
else {
49+
if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
50+
setTimeout(function() {
51+
warningBanner.removeChild(div);
52+
updateBannerVisibility();
53+
}, 5000);
54+
}
55+
updateBannerVisibility();
56+
}
57+
58+
var buildUrl = "Build";
59+
var loaderUrl = buildUrl + "/Challenge2.loader.js";
60+
var config = {
61+
dataUrl: buildUrl + "/Challenge2.data",
62+
frameworkUrl: buildUrl + "/Challenge2.framework.js",
63+
codeUrl: buildUrl + "/Challenge2.wasm",
64+
streamingAssetsUrl: "StreamingAssets",
65+
companyName: "DefaultCompany",
66+
productName: "Challenge 2",
67+
productVersion: "0.1",
68+
showBanner: unityShowBanner,
69+
};
70+
71+
// By default, Unity keeps WebGL canvas render target size matched with
72+
// the DOM size of the canvas element (scaled by window.devicePixelRatio)
73+
// Set this to false if you want to decouple this synchronization from
74+
// happening inside the engine, and you would instead like to size up
75+
// the canvas DOM size and WebGL render target sizes yourself.
76+
// config.matchWebGLToCanvasSize = false;
77+
78+
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
79+
// Mobile device style: fill the whole browser client area with the game canvas:
80+
81+
var meta = document.createElement('meta');
82+
meta.name = 'viewport';
83+
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
84+
document.getElementsByTagName('head')[0].appendChild(meta);
85+
container.className = "unity-mobile";
86+
canvas.className = "unity-mobile";
87+
88+
// To lower canvas resolution on mobile devices to gain some
89+
// performance, uncomment the following line:
90+
// config.devicePixelRatio = 1;
91+
92+
unityShowBanner('WebGL builds are not supported on mobile devices.');
93+
} else {
94+
// Desktop style: Render the game canvas in a window that can be maximized to fullscreen:
95+
96+
canvas.style.width = "960px";
97+
canvas.style.height = "600px";
98+
}
99+
100+
loadingBar.style.display = "block";
101+
102+
var script = document.createElement("script");
103+
script.src = loaderUrl;
104+
script.onload = () => {
105+
createUnityInstance(canvas, config, (progress) => {
106+
progressBarFull.style.width = 100 * progress + "%";
107+
}).then((unityInstance) => {
108+
loadingBar.style.display = "none";
109+
fullscreenButton.onclick = () => {
110+
unityInstance.SetFullscreen(1);
111+
};
112+
}).catch((message) => {
113+
alert(message);
114+
});
115+
};
116+
document.body.appendChild(script);
117+
</script>
118+
</body>
119+
</html>
7.67 MB
Binary file not shown.

Builds/Challenge3/Build/Challenge3.framework.js

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Builds/Challenge3/Build/Challenge3.loader.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
11.7 MB
Binary file not shown.
2.25 KB
Binary file not shown.
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
body { padding: 0; margin: 0 }
2+
#unity-container { position: absolute }
3+
#unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
4+
#unity-container.unity-mobile { width: 100%; height: 100% }
5+
#unity-canvas { background: #231F20 }
6+
.unity-mobile #unity-canvas { width: 100%; height: 100% }
7+
#unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
8+
#unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
9+
#unity-progress-bar-empty { width: 141px; height: 18px; margin-top: 10px; margin-left: 6.5px; background: url('progress-bar-empty-dark.png') no-repeat center }
10+
#unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
11+
#unity-footer { position: relative }
12+
.unity-mobile #unity-footer { display: none }
13+
#unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
14+
#unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
15+
#unity-fullscreen-button { float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
16+
#unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }
2.88 KB

0 commit comments

Comments
 (0)