Skip to content

Instantly share code, notes, and snippets.

@h1ggs
Created January 8, 2018 17:20
Show Gist options
  • Save h1ggs/b80edd54a7375e2d767c93b022b48f53 to your computer and use it in GitHub Desktop.
Save h1ggs/b80edd54a7375e2d767c93b022b48f53 to your computer and use it in GitHub Desktop.
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
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content="Unity,WebGL">
<meta name="description" content="Unity WebGL project">
<meta name="author" content="Add Component">
<title>%UNITY_WEB_NAME%</title>
<link rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" href="img/favicon.ico" />
</head>
<body class="template">
<div class="container clear" id="loading">
<img src="img/logo.png" width="256px" height="256px" alt="logo" title="logo" />
<div class="loader"></div>
</div>
<div class="container clear" id="canvasContainer" style="display:none">
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" height="%UNITY_HEIGHT%px" width="%UNITY_WIDTH%px"></canvas>
<div class="footer">
<a href="http://localhost" target="_blank">
<img src="img/logo.png" width="32px" height="32px" alt="logo" title="logo"/>
</a>
</div>
</div>
%UNITY_WEBGL_LOADER_GLUE%
<script src="js/UnityFunctions.js"></script>
</body>
</html>
<!-- CUSTOM LOADING SCREEN -->
<div class="container clear" id="loading">
<img src="img/logo.png" width="256px" height="256px" alt="logo" title="logo" />
<div class="loader"></div>
</div>
<!-- UNITY WEBGL CANVAS -->
<div class="container clear" id="canvasContainer" style="display:none">
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" height="%UNITY_HEIGHT%px" width="%UNITY_WIDTH%px"></canvas>
<div class="footer">
<a href="http://localhost" target="_blank">
<img src="img/logo.png" width="32px" height="32px" alt="logo" title="logo"/>
</a>
</div>
</div>
1
2
3
4
5
6
7
8
9
Module['onRuntimeInitialized'] = function() {
console.log("Unity is ready!");
showUnity(true);
};
function showUnity(show) {
document.getElementById('loading').style.display = show ? 'none' : '';
document.getElementById('canvas').style.display = show ? '' : 'none';
}
%UNITY_WEBGL_LOADER_GLUE%
<script src="js/UnityFunctions.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment