You cannot show two modal windows at once UnityEngine.GUI:ModalWindow! I do not have UnityEngine.GUI in my Assembly Browser even

Hello everyone,

I’m having trouble with this common error.

You cannot show two modal windows at once
UnityEngine.GUI:ModalWindow(Int32, Rect, WindowFunction, String, GUIStyle)
Facebook.Unity.Editor.EditorFacebookMockDialog:OnGUI()

I am using Facebook SDK 7.9 (latest) with Unity 5.4.2 … And this error opens when I tap invite friends button which has the FB.AppRequest() function.

Here’s the invite code:

public void InviteFriends()
	{
		print ("Facebook Manager Invite Friends");

		FB.AppRequest ("Join me to play Super Finger Runner!", null, null, null, null, null, "Invite to Super Finger Runner", delegate (IAppRequestResult result) {
			Debug.Log ("haya :  " + result.RawResult);
		});		
		
	}

however I see the print “Facebook Manager Invite Friends”, and the error comes after,
and Debug.Log ("haya : " + result.RawResult) never prints.

This means FB.AppRequest is not working …

I search for fb.apprequest not working results and found this link, which was the subject but never solved.

Is there a chance that These 2 versions of facebook sdk and unity 5.4.2f2 will not work and
I have to update one or both ??

Anyone experience in this please :slight_smile:

Thanks

Pretty sure there is an error in the FB SDK, in the editor it is using the old GUI system and base you’re in the editor a mock dialog(see the source here). You can see the OnGUI method execute the ModalWindow on line 49:

public void OnGUI()
{
    GUI.ModalWindow(
        this.GetHashCode(),
        this.modalRect,
        this.OnGUIDialog,
        this.DialogTitle,
        this.modalStyle);
}

This issue should only apply to the editor and not an actual platform build. You can clone the project and change it from a GUI.ModalWindow call to just GUI.Window and that will get ride of the error while executing in the Unity Editor. You will of course have to recompile it from the github source. Or just ignore it and worry about developing the core game. Again this is happening only because of their attempt to place a mock dialog in the editor during design and doesn’t affect the platform build.