Unity3D高级手册0901:装载Unity内容的HTML代码

2014-09-16 21:14:56|?次阅读|上传:huigezrx【已有?条评论】发表评论

关键词:Unity3D, 游戏, 虚拟现实|来源:唯设编程网

Unity Manual > Advanced > Web Player Deployment > HTML code to load Unity content

Unity手册->高级->web播放器部署->装载Unity内容的HTML代码

Web Player content is loaded in the browser using the Unity Web Player's plugin or ActiveX control. The HTML code required to load and display web player content is different for Microsoft's Internet Explorer compared to all other browsers. This is because Internet Explorer uses ActiveX Controls and therefore an object tag must be used whereas all other supported browsers use plugins and therefore an embed tag must be used instead.

Web播放内容被加载在浏览器中使用Unity的Web Player的插件或ActiveX控件。所需的HTML代码加载和显示Web播放器的内容是不同的对于微软IE浏览器与所有其他浏览器比较而言。这是因为Internet Explorer使用ActiveX控件和标签的对象,必须使用而所有其他支持的浏览器支持的插件并且因此内嵌标记必须替代使用。

The HTML file generated by Unity when building a web player contains all the commonly required functionality - it does Unity plugin detection, enables easy web player installation, and supports all browsers that can run Unity Web Player. In most cases you don't have to modify the HTML file at all. This document describes the inner workings of HTML code required for Unity content.

该HTML文件通过Unity生成当创建一个web播放器包含了所有的公共需要的功能-它做Unity的插件检测,启用简单的web播放器安装,并支持所有的浏览器,可以运行Unity的Web播放器。在大多数情况下,你不必修改HTML文件的。本文档描述的HTML代码为Unity的内容进行内部工作。

The minimal HTML required to load Unity Web Player content in all supported browsers is:

所需的最小的HTML加载在所有支持Unity的Web浏览器播放的内容是:

<object id="UnityObject" classid="clsid:444785F1-DE89-4295-863A-D46C3A781394"

    width="600" height="450"

    codebase="http://webplayer.unity3d.com/download_webplayer/UnityWebPlayer.cab#version=2,0,0,0">

    <param name="src" value="MyDataFile.unity3d" />

    <embed id="UnityEmbed" src="MyDataFile.unity3d" width="600" height="450"

        type="application/vnd.unity" pluginspage="http://www.unity3d.com/unity-web-player-2.x" />

</object>

In the above example the object and embed tags are used in such a way that Internet Explorer uses the object tag and ignores the embed tag, while all other browsers use the embed tag and ignore the object tag.

在上面的例子里的object和embed标签中使用这样的方式,Internet Explorer使用的object标记,而忽略embed标签的,而所有其他浏览器使用的标签,而忽略嵌入object标签。

In both the object and embed tags there are various parameters that control how the web player content is displayed:

在这两个object和embed标签里有各种参数控制web播放器内容如何显示:

*       src: Defines the path to the web player data file to be displayed.

*       src:定义路径web播放器数据文件被显示。

*       height, width: Defines the display size for the web player content. The values provided can be pixel values as expressed in the example above (600 pixels wide and 450 pixels tall) or as percentage values (width="100%" for example).

*       高度,宽度:定义的WEB播放器内容显示的大小。所提供的值可在上面的例子表示像素值(600像素宽,450像素高)或百分比值(宽度=“100%”的例子)。

*       id: Can be used by external browser scripts in order to communicate with the web player content. The default id values included when publishing web player content are UnityObject for the object tag and UnityEmbed for the embed tag, but those can be changed to different values as necessary.

*       id:可使用外部浏览器的脚本以便沟通web播放器的内容。默认ID值包括发布web播放器的内容是UnityObject为object的标签和UnityEmbed为embed标签,但这些是可以改变的,以在必要时不同的价值需要。

The other parameters found in the object and embed tags above are required and should not be modified. The codebase and pluginspage parameters point to the location from which the Unity Web Player can be installed. The classid parameter is a unique identifier for the Unity Web Player ActiveX Control and the type parameter is the content mime-type for the Unity Web Player plugin.

在上述的object和embed标签里发现其它参数是必需的而且不应该被修改。基本代码插件页的参数指出在开始Unity的Web播放器可以安装的位置。参数的ClassID是一个Unity的Web Player ActiveX控件和类型参数的唯一标识符是内容的MIME的Unity WEB Player插件类型。     

发表评论0条 】
网友评论(共?条评论)..
Unity3D高级手册0901:装载Unity内容的HTML代码