vendredi 27 février 2015

Facebook Unity3D

I'm trying to integrate my Unity game with facebook and I've got some problem. I've wrote something like that:



void Awake()
{
FB.Init(onInitComplet, onHideUnit);
Debug.Log("Initialized!");
}

private void onInitComplet()
{
Debug.Log("FB initialized");
}

private void onHideUnit(bool isGameShown)
{
if (!isGameShown)
{
Time.timeScale = 0;
}
else
{
Time.timeScale = 1;
}
}


And when I'm starting game, I get error:



NullReferenceException: Facebook object is not yet loaded. Did you call FB.Init()?
FB.get_FacebookImpl () (at Assets/Facebook/Scripts/FB.cs:31)
FB.Init (Facebook.InitDelegate onInitComplete, System.String appId, Boolean cookie, Boolean logging, Boolean status, Boolean xfbml, Boolean frictionlessRequests, Facebook.HideUnityDelegate onHideUnity, System.String authResponse) (at Assets/Facebook/Scripts/FB.cs:160)
FB.Init (Facebook.InitDelegate onInitComplete, Facebook.HideUnityDelegate onHideUnity, System.String authResponse) (at Assets/Facebook/Scripts/FB.cs:92)
FBHolder.Awake () (at Assets/Scripts/Facebook/FBHolder.cs:25)


What can be wrong?


Aucun commentaire:

Enregistrer un commentaire