Facebook SDK 7.3 login system with Unity 5.3

Asked

Viewed 251 times

0

I am implementing the Facebook SDK in my game created in Unity and I am having many 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 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?

1 answer

1

Sorry to Answer in English, but I had the same Issue and Facebook is already Aware of the bug: https://developers.facebook.com/bugs/412005298997939/

They have a temporal 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

  • Can you translate? This is Stackoverflow.

  • To temporarily fix this error, change the Ongui() function of Editorfacebookmockdialog.cs. Facebook to correct the error in the next update.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.