1. 发布网页版Unity自适应网页大小

发布网页版,Unity3D自适应网页大小。这个问题困扰了我很长时间,今天终于把他解决了,给大家分享一下。

这里用Uinty4.0发布网页版,我去掉了里面的标题和下载连接地址的Div,目的是让代码看起来易懂。

自适应网页大小与发布网页时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>

本文链接: http://bbs.9ria.com/thread-207203-1-1.html

http://blog.csdn.net/libeifs/article/details/7200630

http://www.tuicool.com/articles/fI7ziy

http://blog.sina.com.cn/s/blog_bd56822d010169ag.html

http://edu.china.unity3d.com/learning_document/getData?file=/Manual/WebPlayerDeployment.html

[Unity菜鸟] Unity Web Player 相关问题 (待完善)的更多相关文章

  1. [Unity菜鸟] Unity发布web后,从HTML调用本地文件

    1. 遇到的问题 从xml读数据,xml的编码用中文就会乱码,改编码格式就调用不了.目前采用默认的ANSI编码. .exe    .txt  .xlsx  .xml  .test Run     √ ...

  2. [Unity菜鸟] Unity读XML

    1. 在Unity中调试可行,发布成exe可行,发布成web不行 Application.dataPath 在Unity中调试是在“..Assets”文件夹下, 发布成exe文件是在“..yourNa ...

  3. [Unity菜鸟] Unity鼠标双击,鼠标函数整理(未完)

    1. 鼠标双击 void OnGUI() { Event Mouse = Event.current; if (Mouse.isMouse && Mouse.type == Event ...

  4. unity 发布web player版,网页打开报Failed to initialize player's 3D settings

    开始时我装的是unity 5.0.0b1,不知道在哪找的这个版本. web player 装的什么版本也忘了. 最后卸载了web player,重新安装web player并另外安装一个unity4. ...

  5. Unity 5 WebGL vs Web Player

    起原 Unity5.3中看到Web Player未来将到被取消,根据Unity官方blog中称Unity5.4中将会移除web player. 本文从我知道的知识比较一下webPlayer和WebGL ...

  6. unity web player的debug和log信息

    win8模式下 unity web player的报错信息在如下目录下:C:\Users\xxx\AppData\Local\Temp\UnityWebPlayer\log 注:目录里的文件可能被隐藏 ...

  7. unity4.6 failed to update unity web player

    unity4.6 failed to update unity web player 新升级的 4.6.2P2 版本修复了IOS很多的bug. 但突然发现导出的Web版本反而不能工作了. “faile ...

  8. "a newer version of unity web player is required but the auto-update failed"

    问题背景描述: 项目采用winform调用unity web player作为播放器在客户端使用. 在有些环境会出现标题所示错误. 经过一翻研究后发现是插件在向服务器请求更新以下文件时报http 30 ...

  9. chrome提示"安装unity web player"

    网页浏览Unity3D制作的效果时,出现提示"安装unity web player".解决办法如下: →在浏览器中输入:chrome://flags/#enable-npapi 在 ...

随机推荐

  1. template_11实参演绎

    1,演绎过程匹配类型A(来自实参的类型),参数化类型P(行参参数声明)如果被声明的参数是一个引用声明g(T& )那么P就是所引用类型T:f(T)中P就是所声明的参数类: decay指从数组和函 ...

  2. Paying for upgrades, by Bob Arnson

    Following content is reprinted from here, please go to the original website for more information. Au ...

  3. [设计模式]NetworkManagementService中的观察者模式

    观察者模式 观察者模式有如下角色 (1)被观察者(Subject) (2)观察者(Observer) public class Subject{ private: list<Observer&g ...

  4. Open Live Writer增加代码插件

          作为一名程序员,免不了和代码打交道,自然在写博客的时候,也会用到代码的展示,Open Live Writer确实是一个不错的工具,不用再去登录博客的后台,就可以在本地进行文章的编写,但是致 ...

  5. ajaxFileUpload - Post file and data together

    jQuery.extend({ createUploadIframe: function(id, uri) { //create frame var frameId = 'jUploadFrame' ...

  6. 中科红旗倒下,谁来挑战windows

    中科红旗解散 国产操作系统从此梦断 2月10日,关门上锁的中科红旗北京总部大门上粘贴了一张最新公告,这张公告彻底击破了那些仍然坚守公司工作的员工“拯救中国红旗”的希望.该公告称:因北京中科红旗软件技术 ...

  7. SQL Server 2008 安装或卸载时提示“重启计算机失败"的解决办法(转)

    安装或卸载SQL Server 遇到错误提示:以前的某个程序安装已在安装计算机上创建挂起的文件操作.运行安装程序之前必须重新启动计算机.如下图: 解决办法: 1.在开始->运行中输入regedi ...

  8. AWK 介绍

    一.模式和动作 awk脚本是由模式和操作组成的:pattern {action} pattern与{action}两者是可选的.如果没有模式,则action应用到全部记录,如果没有action,则输出 ...

  9. C语言多线程编程

    HANDLE CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, DWORD dwStackSize, LPTHREAD_START_ROUT ...

  10. opencv学习笔记(01)——操作图像的像素

    #include <opencv2\core\core.hpp> #include <opencv2\highgui\highgui.hpp> #include <ope ...