您的位置:首页 > 移动开发 > Unity3D

unity发布网页版(内嵌网页)

2016-02-27 23:08 495 查看
unity打包网页工程自适应全屏。

getServiceHearder() 方法是网页向Unity发消息。参数是物体名、方法名、参数。

<html>
<head>
<title>Itaki标题栏</title>
<style>body{ margin:0; height:100%} html{ height:100%}</style>
<script>
var emid = "UnityEmbed";

if (!!window.ActiveXObject || "ActiveXObject" in window){
emid = "UnityObject";
}

function getServiceHearder(){
var url = window.location.href.substring(0,4);
document.getElementById(emid).SendMessage("jiami","seturl",url);
}
</script>
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" style="overflow: hidden;">
<object id="UnityObject"  classid="clsid:444785F1-DE89-4295-863A-D46C3A781394" width="100%" height="100%"
codebase="http://webplayer.unity3d.com/download_webplayer-3.x/UnityWebPlayerFull.exe">
<param name="src"   value="yysd.unity3d" />
<param name="disableContextMenu"   value="true" />
<embed id="UnityEmbed" src="Unity打包文件名字.unity3d" width="100%" height="100%" type="application/vnd.unity" disableContextMenu="true" pluginspage="http://webplayer.unity3d.com/download_webplayer-3.x/UnityWebPlayerFull.exe"/>
</object>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: