forked from sno/unity-webgl-responsive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
67 lines (56 loc) · 1.86 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!--
unity webgl responsive
template by dom
https://twitter.com/zerstoerer
source code on github
https://github.com/sno/unity-webgl-responsive
-->
<!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 responsive</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="assets/css/reset.css">
<link rel="stylesheet" href="assets/css/style.css">
<script src="assets/js/jquery-3.4.1.min.js"></script>
<!-- unity resources -->
<script src="Build/UnityLoader.js"></script>
<script>
var unityInstance = UnityLoader.instantiate("unityContainer", "Build/example.json");
</script>
</head>
<body>
<div class="webgl-wrapper">
<div class="aspect"></div>
<div class="webgl-content">
<div id="unityContainer"></div>
</div>
</div>
<div class="info">
<p>unity webgl responsive</p>
<p>press F or <a href="#" onclick="unityInstance.SetFullscreen(1)">click here</a> to toggle fullscreen</p>
</div>
<!-- feel free to remove all credits! -->
<div class="info">
<p>source code on <a href="https://github.com/sno/unity-webgl-responsive">github</a></p>
<p>template by dom / <a href="https://twitter.com/zerstoerer">@zerstoerer</a></p>
</div>
<!-- check for F key press to toggle full screen -->
<script>
var isFullscreen = false;
document.addEventListener('keydown', function(event) {
if (event.which === 70) {
if (!isFullscreen) {
unityInstance.SetFullscreen(1);
} else {
unityInstance.SetFullscreen(0);
}
isFullscreen = !isFullscreen;
}
});
</script>
</body>
</html>