Application.srcValue 源文件

static var srcValue : string

Description描述

The path to the web player data file relative to the html file (Read Only).

相对于html文件的web播放器数据文件的路径(只读)。

Actually this is whatever path is written in the html file as a src parameter to object and embed tags. So if it's the absolute URL,srcValue will have the absolute path.

这是被写到html文件中的路径,它是作为object的src参数和cmbed标签。因此如果它是绝对url,srcvalue将含有绝对路径。

Application.absoluteURL and Application.srcValue allow you to detect if your unityWeb data file was moved to another location or is being linked to. You might want to protect against both to prevent piracy of your data files.

Application.absoluteURL 和 Application.srcValue允许你检测你的unityWeb数据文件是否被移动或链接到其他位置。你也许想保护这两者来阻止盗用数据文件的行为。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Start() {
		bool isPirated = false;
		if (Application.isWebPlayer) {
			if (Application.srcValue != "game.unity3d")
				isPirated = true;

			if (String.Compare(Application.absoluteURL, "http://www.website.com/Game/game.unity3d", true) != 0)
				isPirated = true;

			if (isPirated)
				print("Pirated web player");

		}
	}
}
// This detects if your data files were moved to another server
// 检测你的数据文件是否被移到其他的服务器
// or are being linked to from somewhere else.
// 或是被链接到其他地方

function Start () {
	var isPirated : boolean = false;

	if (Application.isWebPlayer) {
		if (Application.srcValue != "game.unity3d")
			isPirated = true;

		if (String.Compare (Application.absoluteURL,	"http://www.website.com/Game/game.unity3d", true) != 0)
			isPirated = true;

		if (isPirated)
			print("Pirated web player");
	}
}
Page last updated: 2010-12-15