unity 生成webGL自适应屏幕

在生成的html里面修改代码
    <script type="text/javascript">
    function Reset() {
 var canvas = document.getElementById("#canvas"); 
canvas.height= document.documentElement.clientHeight;
 canvas.width = document.documentElement.clientWidth; 
console.log(canvas.width );
 } 
    </script>
  </head>
  <body onload="Reset()" onresize="Reset()">
      <div class="webgl-content"style="width: 100%; height: 100%" >
      <div id="gameContainer" style="width: 100%; height: 100%"></div>
    </div>
  </body>
</html>
来实现网页版随浏览器自适应

猜你喜欢

转载自blog.csdn.net/qq_38456478/article/details/78869971
今日推荐