我们正尝试将统一的3D游戏转换为Facebook即时游戏,为此,我们使用资产:https://assetstore.unity.com/packages/templates/tutorials/facebook-instant-game-exporter-144399
facebook即时游戏在android设备上可以很好地加载,但是加载时间较长,但是某些iphone设备无法正常工作,它在加载屏幕上停留在70%至100%之间,我们正在尝试修复加载问题,我们的索引文件如下所示:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Instant Game Exporter</title>
<meta name='viewport' content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no'/>
<meta name="renderer" content="webkit"/>
<meta name='apple-mobile-web-app-capable' content='yes' />
<meta name='full-screen' content='true' />
<meta name='x5-fullscreen' content='true' />
<meta name='360-fullscreen' content='true' />
<meta name="bilinig" screenorientation ="landscape"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta http-equiv='expires' content='0' />
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<script src="TemplateData/UnityProgress.js"></script>
<script src="Build/UnityLoader.js"></script>
<script src="https://connect.facebook.net/en_US/fbinstant.6.3.js"></script>
<script>
var gameInstance;
FBInstant.initializeAsync().then(function() {
gameInstance = UnityLoader.instantiate("gameContainer", "Build/web.json", {onProgress: UnityProgress});
});
</script>
</head>
<body style="user-select: none; -webkit-tap-highlight-color: rgba(200, 200, 200, 0);margin:0px;">
<div id="gameContainer" style="position: absolute; left:0px; top:0px; width:100%; height:100%;"></div>
</body>
</html>
我们的unityprogress.js看起来像这样:
let _qmg_is_process_full=false;
function UnityProgress(gameInstance,progress){
if(!gameInstance.Module)
return;
FBInstant.setLoadingProgress(100*progress);
if(progress==1&&!_qmg_is_process_full){_qmg_is_process_full=true;
FBInstant.startGameAsync().then(function(){console.log("startGameAsync");
console.log("StartGameLogic|in|__IGEXPORTER__");
gameInstance.SendMessage("__IGEXPORTER__","StartGameLogic")})}}