Unityがエクスポートしたwebglエンジニアリングは、pc側とモバイル側をフルスクリーンで適応させる
Unity WebGL Player | testweb
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/webgl.json", {onProgress: UnityProgress});
--
function Reset()
{
var canvas = document.getElementById("#canvas");// #canvas
canvas.height= document.documentElement.clientHeight;// body
canvas.width = document.documentElement.clientWidth;// body
}
--body index.html
別の方法
Unity WebGL Player | farm
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/webgl.json", {onProgress: UnityProgress});
function ChangeCanvas()
{
document.getElementById("gameContainer").style.width = window.innerWidth + "px";
document.getElementById("gameContainer").style.height = window.innerHeight + "px";
document.getElementById("#canvas").style.width = window.innerWidth + "px";
document.getElementById("#canvas").style.height = window.innerHeight + "px";
}