How do I know if my game is connecting to Kongregate's API?

Hello. I might have gotten my API to connect, but I have no idea. How do I know if I successfully connected? The game is unpublished. Thank you. -Keavon

EDIT: This is my script:

// Begin the API loading process if it is available

Application.ExternalEval(

  "if(typeof(kongregateUnitySupport) != 'undefined'){" +

  " kongregateUnitySupport.initAPI('MyUnityObject', 'OnKongregateAPILoaded');" +

  "};"

);

var isKongregate = false;

var userId = 0;

var username = "Guest";

var gameAuthToken = "";

function OnKongregateAPILoaded(userInfoString){

  // 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 OnGUI(){

GUI.Box(Rect(0,0,100,20), username);

}

Thank you!

You can use OnGUI function:

function OnGUI(){
GUI.Box(Rect(0,0,100,20), username);

}

there are a delay about 5 seconds, it will start showing "Guest". After connected, will show the username connected.

Edit:

For your edit: You need to rename your unity object the same name as you call in the function:

kongregateUnitySupport.initAPI('MyUnityObject', 'OnKongregateAPILoaded')

In this line, MyUnityObject is the name of the object with this script.

The ExternEval function is used in Start function;

@Keavon Yes, where it says 'MyUnityObject' replace that with the name in the inspector of your thing that this script is attached to. So, for example, create a Cube in scene view, attach the script to it and in the script it should read kongregateUnitySupport.initAPI('Cube', 'OnKongregateAPILoaded');