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

スクリプト言語

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

Application.srcValue

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static var srcValue: string;
public static string srcValue;
public static srcValue as 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");
		}
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : 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");
            
        }
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Start() as void:
		isPirated as bool = 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')