Hi, I need some help.
I'm having problem implementing the Kongregate API.
I have Used this little script:
var isKongregate = false;
var userId = 0;
var username = "Guest";
var gameAuthToken = "";
function OnKongregateAPILoaded(userInfoString : String){
// We now know we're on Kongregate
isKongregate = true;
// Split the user info up into tokens
var params = userInfoString.Split("|"[0]);
userId = parseInt(params[0]);
username = params[1];
gameAuthToken = params[2];
}
function Awake(){
// Begin the API loading process if it is available
Application.ExternalEval(
"if(typeof(kongregateUnitySupport) != 'undefined'){" +
" kongregateUnitySupport.initAPI('MyUnityObject', 'OnKongregateAPILoaded');" +
"};"
);
}
function OnGUI(){
GUI.Box(Rect(0,0,100,20),isKongregate.ToString());
}
- I upload the .unity3d to kongregate
- If I use a externalEval with "alert(typeof(kongregateUnitySupport))", it will alert "Object". It means that the object exists.
- The Script calls the initAPI function of this script but doesn't call back the OnKongregateAPILoaded function.
- The GUI.Box ever show the message "False" what is to be modified when the function is called.
I have used this example: http://answers.unity3d.com/questions/33227/how-do-i-implement-the-kongregate-api But doesn't works.
The Kongregate.Package in the Unity.com page have the some problem to me.
please, help me.
Thanks, William Borgo