Reputation: 21
Working on a Unity game for Android using Facebook's Unity plugin (v5.0.3). Facebook login has been working fine for the majority of our users for a while now. Although recently we received the following crash report from Crittercism. Curious if anyone else has experienced this and has some tips?
Pretty sure we are calling FB.Init() correctly in our C Sharp code - have traced through the flow using the Android monitor tool to watch logs.
In the meantime, we have added more logging to try to get more information.
Thank you!
Stack Trace
_________________________________
0 java.lang.Exception: NullReferenceException: Facebook object is not yet loaded. Did you call FB.Init()?
1 at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
2 at com.unity3d.player.UnityPlayer.a(Unknown Source)
3 at com.unity3d.player.UnityPlayer$a.run(Unknown Source)
4 Caused by: java.lang.Throwable: FB.get_FacebookImpl ()
5 FB.Login (System.String scope, Facebook.FacebookDelegate callback)
6 Zynga.Casino.Auth.FacebookUser.OnInitComplete ()
7 Zynga.Casino.Auth.FacebookUser.LogIn ()
8 Zynga.Poker.Auth.Unity.FacebookLogin.LogInFacebookUser ()
9 Zynga.Poker.Auth.Unity.FacebookLogin.OnPress (Boolean isDown)
10 UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
11 UICamera:Notify(GameObject, String, Object)
12 UICamera:ProcessTouch(Boolean, Boolean)
13 UICamera:ProcessTouches()
14 UICamera:Update()
15
16 ... 3 more
17 java.lang.Throwable: FB.get_FacebookImpl ()
18 FB.Login (System.String scope, Facebook.FacebookDelegate callback)
19 Zynga.Casino.Auth.FacebookUser.OnInitComplete ()
20 Zynga.Casino.Auth.FacebookUser.LogIn ()
21 Zynga.Poker.Auth.Unity.FacebookLogin.LogInFacebookUser ()
22 Zynga.Poker.Auth.Unity.FacebookLogin.OnPress (Boolean isDown)
23 UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
24 UICamera:Notify(GameObject, String, Object)
25 UICamera:ProcessTouch(Boolean, Boolean)
26 UICamera:ProcessTouches()
27 UICamera:Update()
28
29 at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
30 at com.unity3d.player.UnityPlayer.a(Unknown Source)
31 at com.unity3d.player.UnityPlayer$a.run(Unknown Source)
Upvotes: 1
Views: 1234
Reputation: 493
I know I'm 7 years too late, but hope this helps someone
I had a similar issue in our app. We were using an internal SDK that handled Facebook initialisation. I fixed the issue by explicitly waiting for the FB initialisation to finish in a coroutine, before loading a new scene.
The FB.Init()
call is asynchronous. My hypothesise is that if there is a scene change before the init is complete, the it remains uninitialised. Due to our internal SDK, I could not modify the onInitComplete
callback, so this is the best hack fix I could do.
IEnumerator LoadMenuSceneRoutine()
{
while (!FB.IsInitialized)
{
yield return null;
}
LoadMenuScene();
}
Upvotes: 0