Application.absoluteURL 绝对URL

static var absoluteURL : string

Description描述

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

到web播放器数据文件夹的绝对路径(只读)。

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");
	}
}
最后修改:2010年12月15日 Wednesday 0:18

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。