Sitelock not working for my unity game.

8 posts (showing 1-8)
madpoet

Market Level 0Community Level 1
28 posts

function Start () {

Any tips on how to get site locking to work in unity?

I'm using this code and it always reports as hacked.

Thx for any help!  No response from FGL thus far  ...:(

var isPirated : boolean = false;

if (Application.isWebPlayer) {

if (String.Compare (Application.absoluteURL,
"http://www.flashgamelicense", true) != 0)
isPirated = true;

if (isPirated)
Application.LoadLevel("hacked");
}
}

posted 2013-01-30T16:54:15-08:00
GroZZleR

Market Level 7Community Level 10
1594 posts

You should sitelock it to both http and https, you're most likely being served from the secure server.

posted 2013-01-30T18:19:12-08:00
madpoet

Market Level 0Community Level 1
28 posts

Thx GroZZier! Trying that now.

posted 2013-01-30T18:41:56-08:00
madpoet

Market Level 0Community Level 1
28 posts

WORKED!

Thx GroZZier! .  I'm grateful..:)

var isPirated : boolean = false;

function Start () {





if (String.Compare (Application.absoluteURL, "http://www.flashgamelicense", true) != 0){
isPirated = true;
}
if (String.Compare (Application.absoluteURL, "https://www.flashgamelicense", true) != 0){
isPirated = true;
}



if (isPirated){
Application.LoadLevel("hacked");
}

}

posted 2013-01-30T18:46:31-08:00
madpoet

Market Level 0Community Level 1
28 posts

Actually, it didn't. I uled the wrong file.  Tried again and it is still showing hacked screen..:((((

posted 2013-01-30T18:59:48-08:00
Antriel

Market Level 4Community Level 9
515 posts

Not sure what are you trying to accomplish but unless absoluteURL can be both http AND https, isPirated will always be true.
Meaning one of these conditions will always fail.
Correct your logic :)

if (String.Compare (Application.absoluteURL, "http://www.flashgamelicense", true) != 0 &&
String.Compare (Application.absoluteURL, "https://www.flashgamelicense", true) != 0){
isPirated = true;
}

posted 2013-01-30T19:05:03-08:00 | edited 2013-01-30T19:05:51-08:00
madpoet

Market Level 0Community Level 1
28 posts

My bad!

Corrected and works!  Thx!

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


urladdress = Application.absoluteURL;
if(urladdress == "http://www.flashgamelicense.com"){
isPirated = true;
}
if(urladdress == "https://www.flashgamelicense.com"){
isPirated = true;
}



if (isPirated){
Application.LoadLevel("hacked");
}

}

posted 2013-01-30T19:19:31-08:00
FGL_Eric

FGL AdminCommunity Level 13
3719 posts

BTW, we've phased out http://, so actually nowadays you only need to sitelock to https://

posted 2013-02-22T19:44:20-08:00