- Home /
Cannot initialise Kong API
Im trying to use the Kongregate API but I can't get it working. I have uploaded the unity3d package to Kong (and of course used another script to display the results from this script) but I cannot get it to work. It just says its not connected. Please help! (What I really want is a working out of the box example package. Then I can modify the example.) Also please make your scripts in JavaScript because I actually understand that. This is my code:
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()); }
Thankyou!
Answer by Borgo · Jan 13, 2011 at 06:02 PM
Hi,
You have used the same example as me?
http://answers.unity3d.com/questions/35434/unity-kongregate-api-problem
I'm trying to resolve this too. Just follow my question and vote it up, you don't need to post the same question. I'm thinking about to start a bounty for my question.
I sent a email to Kongregate support too.
Good look!!
Answer by Borgo · Jan 14, 2011 at 10:39 AM
http://answers.unity3d.com/questions/35434/unity-kongregate-api-problem
Resolved.
In this line:
kongregateUnitySupport.initAPI('MyUnityObject', 'OnKongregateAPILoaded');
MyUnityObject is the name of object on UNITY, so you need to create a object called MyUnityObject and attach the script on it.
Your answer
Follow this Question
Related Questions
Help with Kongregate API? 0 Answers
How do I implement the Kongregate api 4 Answers
Using the Kongregate API 1 Answer
LiveGamer Integration 0 Answers
Kongregate Shared Content API 1 Answer