Facebook login system SDK 7.3 with Unity 5.3

0

I'm implementing the Facebook SDK in my Unity-created game and I'm having a lot of problems.   I tried to implement the Facebook login system:

FB.LogInWithReadPermissions(new List<string>() { "public_profile", "email", "user_friends" }, AuthCallBack);

Only the following errors appeared:

  

NullReferenceException: Object reference not set to an instance of an object

     

NullReferenceException: Object reference not set to an   instance of an object UnityEngine.GUILayoutEntry.ApplyStyleSettings   (UnityEngine.GUIStyle style) (at
  C: /buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs: 507)   UnityEngine.GUILayoutGroup.ApplyStyleSettings (UnityEngine.GUIStyle   style (at   C: /buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs: 626)   UnityEngine.GUILayoutEntry.set_style (UnityEngine.GUIStyle value) (at   C: /buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:471)   UnityEngine.GUILayoutUtility.BeginWindow (Int32 windowID,   UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption [] options) (at   C: /buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs: 91)   UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func,   Int32 id, UnityEngine.GUISkin _skin, Int32 forceRect, Single width,   Single height, UnityEngine.GUIStyle style) (at   C: /buildslave/unity/build/Runtime/IMGUI/Managed/GUI.cs:1862)

     

ArgumentException: Getting control 0's position in a group with only 0 controls when doing Repaint
  ArgumentException: Getting control   0's position in a group with only 0 controls when doing Repaint   Aborting UnityEngine.GUILayoutGroup.GetNext () (at   C: /buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:656)   UnityEngine.GUILayoutUtility.DoGetRect (Single minWidth, Single   maxWidth, Single minHeight, Single maxHeight, UnityEngine.GUIStyle   style, UnityEngine.GUILayoutOption [] options) (at   C: /buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:401)   UnityEngine.GUILayoutUtility.GetRect (Single width, Single height,   UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption [] options) (at   C: /buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs: 375)   UnityEngine.GUILayout.Space (Single pixels) (at   C: /buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:247)   Facebook.Unity.Editor.EditorFacebookMockDialog.OnGUIDialog (Int32   windowId) (at   Assets / FacebookSDK / SDK / Scripts / PlatformEditor / EditorFacebookMockDialog.cs: 90)   UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func,   Int32 id, UnityEngine.GUISkin _skin, Int32 forceRect, Single width,   Single height, UnityEngine.GUIStyle style) (at   C: /buildslave/unity/build/Runtime/IMGUI/Managed/GUI.cs:1869)

How to solve this?

    
asked by anonymous 05.01.2016 / 03:48

1 answer

1

Sorry to answer in English, but I had the same issue and Facebook is already aware of the bug: link

They have a temporary workaround: in EditorFacebookMockDialog.cs add this to the begin of the OnGUI method:

if (this.modalStyle == null)
{
    this.modalRect = new Rect(10, 10, Screen.width - 20, Screen.height - 20);
    Texture2D texture = new Texture2D(1, 1);
    texture.SetPixel(0, 0, new Color(0.2f, 0.2f, 0.2f, 1.0f));
    texture.Apply();
    this.modalStyle = new GUIStyle(GUI.skin.window);
    this.modalStyle.normal.background = texture;
}

It should end up like this:

public void OnGUI()
{
    if (this.modalStyle == null) {
        this.modalRect = new Rect(10, 10, Screen.width - 20, Screen.height - 20);
        Texture2D texture = new Texture2D(1, 1);
        texture.SetPixel(0, 0, new Color(0.2f, 0.2f, 0.2f, 1.0f));
        texture.Apply();
        this.modalStyle = new GUIStyle(GUI.skin.window);
        this.modalStyle.normal.background = texture;
    }
    GUI.ModalWindow(
            this.GetHashCode(),
            this.modalRect,
            this.OnGUIDialog,
            this.DialogTitle,
            this.modalStyle);
}

They say they are going to fix this for the next update

    
05.01.2016 / 14:40