Customizing the Unity Web Player's Behavior 自定义Unity网络播放器的行为

Date:2011-10-28
Desktop

The Unity Web Player allows developers to use a few optional parameters to easily control its behavior in a few ways:

Unity网络播放器允许开发者使用一些可选参数来轻松地控制其在几个方面的行为:

  • disableContextMenu: This parameter controls whether or not the Unity Web Player displays a context menu when the user right- or control-clicks on the content. Setting it to true prevents the context menu from appearing and allows content to utilize right-mouse behavior. To enable the context menu don't include this parameter.
    禁用上下文菜单:此参数控制Unity网络播放器的上下文菜单,在用户在内容上右键点击时是否显示。设置为true不显示上下文菜单,以禁用鼠标右键行为。
  • disableExternalCall: This parameter controls whether or not the Unity Web Player allows content to communicate with browser-based JavaScript. Setting it to true prevents browser communication and so content cannot call or execute JavaScript in the browser, the default is false.
    禁用外部调用:这个参数控制是否允许Unity网络播放器与浏览器JavaScript通信。设置为true,阻止浏览器通信,因此,在浏览器内容不能调用或执行JavaScript ,默认为false。
  • disableFullscreen: This parameter controls whether or not the Unity Web Player allows content to be viewed in fullscreen mode. Setting it to true prevents fullscreen viewing and removes the "Go Fullscreen" entry from the context menu, the default is false.
    禁用全屏:这个参数控制是否允许Unity网络播放器以全屏模式显示内容。设置为true,禁用全屏浏览,并删除上下文菜单中的Go Fullscreen入口。默认为false。

Here is an example script that limits the behavior of the Unity Web Player, the context menu will not be shown. Although there is only one parameter it still must be placed inside params object and passed to unityObject.embedUnity method.

这个脚本例子是限制Unity网络播放器的行为,上下文菜单将不显示。虽然只有一个参数,它仍然必须放在params对象中并传递到unityObject.embedUnity的方法。

var params = {
	disableContextMenu: true
};

unityObject.embedUnity("unityPlayer", "WebPlayer.unity3d", 600, 450, params);

In the above example you'll notice that neither disableExternalCall nor disableFullscreen are specified, therefore their default values are used.

在上面的例子注意,既没有指定disableExternalCall也没有指定disableFullscreen,因此他们使用默认的值。

Page last updated: 2010-07-12

分类:Manual|评论: 0|浏览: 32 翻译: U_鹰
评论
暂无评论
发表评论
用户名:

评论审核后才会显示!