Customizing the Unity Web Player loading screen 自定义Unity网络播放器加载的屏幕

优质
小牛编辑
142浏览
2023-12-01
Desktop

By default the Unity Web Player displays a small Unity logo and a progress bar while loading web player content. It is possible to customize the appearance of that loading screen, including both the logo and progress bar display.

默认,在加载网络播放器内容时,Unity网络播放器显示一个小的Unity标志和进度条。可以自定义加载屏幕的外观,包括日志和进度条显示。

Please note that modifying the loader images is only possible with Unity Pro.

请注意,修改加载图片只能使用Unity专业版。

There are six optional parameters that can be used to customize the appearance of the Unity Web Player loading screen. Those optional parameters are:

有六个可选参数用来自定义Unity网络播放器加载屏幕的显示,这些可选参数是:

  • backgroundcolor: The background color of the web player content display region during loading, the default is white.
    背景颜色:加载期间,网络播放器内容显示区域的背景颜色,默认是白色。
  • bordercolor: The color of the one pixel border drawn around the web player content display region during loading, the default is white.
    边框颜色:加载期间,网络播放器内容显示区域背边框颜色,默认是白色。
  • textcolor: The color of error message text (when data file fails to load for example). The default is black or white, depending on the background color.
    文本颜色:错误消息文本颜色(例如当数据文件加载失败)。默认为黑色或白色,取决于背景颜色。
  • logoimage: The path to a custom logo image, the logo image is drawn centered within the web player content display region during loading.
    标志图片:自定义标志图片的路径,在网络播放器内容显示区域加载期间,在中心绘制的标志图片。
  • progressbarimage: The path to a custom image used as the progress bar during loading. The progress bar image's width is clipped based on the amount of file loading completed, therefore it starts with a zero pixel width and animates to its original width when the loading is complete. The progress bar is drawn beneath the logo image.
    进度条图片:用来加载期间进度条的自定义图片路径。进度条图片的宽度被裁减,基于加载完成的文件数,因此,当加载完成时,从开始的零像素宽度并动画到它的原始宽度。标志图片下方的进度条将被绘制。
  • progressframeimage: The path to a custom image used to frame the progress bar during loading.
    帧进度图片:自定义图片路径用于加载期间的帧进度条。

All color values provided must be 6-digit hexidecimal colors, (eg. FFFFFF, 020F16, etc.). The image paths provided can be either relative or absolute links and all image files must be RGB (without transparency) or RGBA (with transparency) 8-bit/channel PNG files. Finally, the progressframeimage and the progressbarimage should be the same height.

提供所有颜色值必须是6位数字的十六进制颜色(例如,FFFFFF,020F16等),所提供的图像路径可以是相对或绝对链接,所有图片文件必须是RGB()不带透明或RGBA(带透明) 8位/通道 PNG文件。最后,progressframeimage的progressbarimage应同一高度。

Here is an example script that customizes the appearance of the Unity Web Player loading screen. The background color is set to light gray (A0A0A0), border color to black (000000), text color to white (FFFFFF) and loader images to MyLogo.png, MyProgressBar.png and MyProgressFrame.png. All parameters are grouped into single params object and passed to unityObject.embedUnity method.

这个例子脚本,自定义Unity网络播放器加载屏幕的外观。背景颜色设置为亮灰(A0A0A0),文本颜色设置为白色(FFFFFF),加载图片为MYLogo.png,MyProgressBar.png和MyProgressFrame.png。所有参数被分组到单个参数对象,并传递到unityObject.embedUnity方法。

var params = {
	backgroundcolor: "A0A0A0",
	bordercolor: "000000",
	textcolor: "FFFFFF",
	logoimage: "MyLogo.png",
	progressbarimage: "MyProgressBar.png",
	progressframeimage: "MyProgressFrame.png"
};

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

页面最后更新:2010-07-12