static var m_Score : int = 0;
static var m_LevelNumber : int = 0;
static var instance : Persistent;
//Awake
function Awake() {
if (instance == null) {
DontDestroyOnLoad(gameObject);
instance = this;
}
else Destroy(this.gameObject);
}
// This detects if your data files were moved to another server
// or are being linked to from somewhere else.
function Start () {
print("========== "+Application.absoluteURL +" === http://www.gonegypsygames.com/test/CCDemo.unity3d");
var isPirated = false;
if (Application.platform == RuntimePlatform.WindowsWebPlayer || Application.platform == RuntimePlatform.OSXWebPlayer) {
//if (Application.srcValue != "CCDemo.unity3d") isPirated = true;
if (String.Compare (Application.absoluteURL, "http://www.gonegypsygames/test/CCDemo.unity3d", true) != 0) isPirated = true;
if (isPirated) Application.OpenURL ("http://www.gonegypsygames.com/test");
}
}
Ok this code came from the 2.0 Docs and I made it redirect if isPirated == true. BUT It’s always pirated! I can’t get it to not be. What’s wrong with it? I even put the print statement in there and it prints
Thank you!
Cheers,
That’s weird…is it possible there’s some kind of non-printing character in the URL, so even though it looks the same as the string, they’re actually different in some subtle but annoying way? (Print out Application.absoluteURL.length and see if it’s the same as the string’s .length.)
–Eric
I share the confusion here, of course I’m also wondering why our docs (and now you) are using String.Compare() instead of just == or !=. These are string data elements, not String objects, so they should easily be compared using == or != (you may want to force to all lower-case). Of course that just dodges the real problem at hand, but in the interest of having you up and running…
// This detects if your data files were moved to another server
// or are being linked to from somewhere else.
function Start () {
print("=="+Application.absoluteURL +"==http://www.yourdomain.com/your.unity3d");
var isPirated = false;
if (Application.platform == RuntimePlatform.WindowsWebPlayer ||
Application.platform == RuntimePlatform.OSXWebPlayer) {
var domainName = Application.absoluteURL.ToLower();
if (domainName != "http://www.yourdomain.com/your.unity3d") isPirated = true;
if (isPirated) Application.OpenURL ("http://www.yourdomain.com/");
}
}
This code works! - Thanks To All Who Helped. 
Cheers!