-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
50 lines (47 loc) · 1.97 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unity WebGL Player | ProjectB</title>
</head>
<body style="text-align: left; background: #231F20">
<canvas id="unity-canvas" width=540 height=960 style="width: 540px; height: 100%; background: #231F20"></canvas>
<script src="Build/ProjectB_Web.loader.js"></script>
<script>
console.log(`navigator.userAgent: ${navigator.userAgent}`);
var canvas = document.getElementById('unity-canvas')
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
// Mobile device style: fill the whole browser client area with the game canvas:
var meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
document.getElementsByTagName('head')[0].appendChild(meta);
canvas.style.width = '100%';
canvas.style.height = '100%';
} else {
function autoResizeDiv()
{
var height = window.innerHeight;
if (height > 1100) {
height = 1100;
}
canvas.style.height = height +'px';
}
window.onresize = autoResizeDiv;
autoResizeDiv();
}
createUnityInstance(document.querySelector("#unity-canvas"), {
dataUrl: "Build/ProjectB_Web.data",
frameworkUrl: "Build/ProjectB_Web.framework.js",
codeUrl: "Build/ProjectB_Web.wasm",
streamingAssetsUrl: "StreamingAssets",
companyName: "DefaultCompany",
productName: "ProjectB",
productVersion: "1.0",
//matchWebGLToCanvasSize: false, // Uncomment this to separately control WebGL canvas render size and DOM element size.
devicePixelRatio: 1, // Uncomment this to override low DPI rendering on high DPI displays.
});
</script>
</body>
</html>