言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Application.srcValue

public static var srcValue: string;

Description

WebPlayerゲームデータのHTMLからの相対的なパスを返します(RO)

実はこのパスは src パラメーターが objectembed タグのようにHTMLファイルに記述されています。 なので絶対URLの場合、 srcValue は絶対パスを持つことになります。 Application.absoluteURLとApplication.srcValueはWebPlayerのデータが移動されたり他のリンクになってリ待った時に検知することが可能です。 データファイルの著作権侵害から守るためにもオススメします。

	// 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");
		}
	}