全屏
1、把index.html文件改成以下代码
2、代码中Build/webgl.json的‘webgl’改成自己的项目名称
<!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 | Lighting Box</title>
<link rel="shortcut icon" href="TemplateData/favicon.ico">
<link rel="stylesheet" href="TemplateData/style.css">
<script src="TemplateData/UnityProgress.js"></script>
<script src="Build/UnityLoader.js"></script>
<script>
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/webgl.json", {onProgress: UnityProgress});
</script>
<style>
body{margin:0px;padding:0px;height: 100%; width:100%;position: absolute;}
#gameContainer,.webgl-content{width: 100%; height: 100%;}
</style>
</head>
<body>
<div class="webgl-content">
<div id="gameContainer"></div>
</div>
</body>
</html>
不出现开场提示
- 打开unityLoader.js文件
- 复制里面的所有内容
- 打开js解密网站https://www.sojson.com/jsjiemi.html
- 把unityLoader.js文件清空,复制解密‘执行结果’里面的代码,粘贴在unityLoader.js
- 在unityLoader.js中查找‘compatibilityCheck’方法
- 用以下代码替换一下图片中红色框中的内容
compatibilityCheck:function(e,t,r){ UnityLoader.SystemInfo.hasWebGL? UnityLoader.SystemInfo.mobile? t() :["Firefox","Chrome","Safari"].indexOf(UnityLoader.SystemInfo.browser)==-1? t() :t() :e.popup("Your browser does not support WebGL",[{text:"OK",callback:r}]) },