- 最后登录
- 2016-8-29
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 23585
- 纳金币
- 20645
- 精华
- 62
|
自适应网页大小与发布网页时PlayerSettings设置的width和height大小无关,只要讲网页里面的标注的代码设置好,就可以实现U3D自适应网页大小。- <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
-
- <html xmlns=“http://www.w3.org/1999/xhtml”>
-
- <head>
-
- <meta http-equiv=“Content-Type” content=“text/html; charset=utf-8”>
-
- <title>Unity Web Player | ceshiExt</title>
-
- <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
-
- <script type=“text/javascript”>
-
- <!--
-
- var unityObjectUrl = “http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject2.js”;
-
- if (document.location.protocol == 'https:')
-
- unityObjectUrl = unityObjectUrl.replace(“http://”, “https://ssl-”);
-
- document.write('<script type=“text\/javascript” src=“‘ + unityObjectUrl + ’”><\/script>');
-
- -->
-
- </script>
-
- <script type=“text/javascript”>
-
- <!--
-
- var config = {
-
- width: '100%', //设置成100%
-
- height: '100%' //设置成100%
-
- };
-
- var u = new UnityObject2(config);
-
- jQuery(function() {
-
- u.initPlugin(jQuery(“#unityPlayer”)[0], “Decor.unity3d”);
-
- });
-
- -->
-
- </script>
-
- <style type=“text/css”>
-
- <!--
-
- html,body{ height:100%; margin:0px auto;} //注意这段样式是后添加进来的
-
- div#unityPlayer {
-
- width: 100%; //设置成100%
-
- margin: 0 auto;
-
- background: #FFFF00;
-
- height: 100%; //设置成100%
-
- }
-
- -->
-
- </style>
-
- </head>
-
- <body>
-
- <div id=“unityPlayer”>
-
- </div>
-
- </body>
-
- </html>
复制代码 |
|