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

来源:互联网 发布:2016淘宝怎么做爆款 编辑:程序博客网 时间:2024/05/19 12:12

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>
0 0