kongregateUnitySupport not always loading

2 posts

Flag Post

I’ve made a unity game for Kongregate, and I use the supplied code to get the users account, but the api to get it only seems to work roughly 50% of the time.

The code is as follows:

public static void GetKongregateLogin ()
		Debug.Log("Getting Kongregate Login");
		websiteType = WebsiteType.Kongregate;
		timeOut = Time.time + 10;
		// Begin the API loading process if it is available
		Application.ExternalEval (
  			"if(typeof(kongregateUnitySupport) != 'undefined'){" +
  			" kongregateUnitySupport.initAPI('FacebookManager', 'OnKongregateAPILoaded');" +

I then have:

void OnKongregateAPILoaded (string userInfoString)
    Debug.Log("Kongregate API Loaded");

along with a timeout function is the api isn’t loaded after 10 seconds (in which case it will try do it again).

The problem is that OnKongregateAPILoaded() isn’t called half the time, as if the api isn’t being loaded. Can anyone see anything I am doing wrong, or know anything about what might be causing this?


Flag Post

Ah don’t worry, I managed to fix it. My game had a left over js call that was being run every frame and was blocking the loading of the api.