- Home /
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 :)
Thanks
i have this problem, and i am not find the solution until now
Answer by Landern · Dec 13, 2016 at 02:43 PM
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.
@Landern thanks for the answer, but as I build an apk and install, the invite does not do anything, but it worked properly when I had the project with untiy 4.6.
I know its an editor error, but strange it does not respond to tap on my android device as well.
Also I don't know why I can't find the $$anonymous$$odalWindow in my whole solution
I just followed the path mentioned in the github link and found the script.
here's the code:
namespace Facebook.Unity.Editor
{
internal abstract class EditorFacebook$$anonymous$$ockDialog : $$anonymous$$onoBehaviour
{
//
// Fields
//
private Rect modalRect;
private GUIStyle modalStyle;
//
// Properties
//
public Utilities.Callback<ResultContainer> Callback {
[CompilerGenerated]
protected get;
[CompilerGenerated]
set;
}
public string CallbackID {
[CompilerGenerated]
protected get;
[CompilerGenerated]
set;
}
protected abstract string DialogTitle {
get;
}
//
// Constructors
//
protected EditorFacebook$$anonymous$$ockDialog ();
//
// $$anonymous$$ethods
//
protected abstract void DoGui ();
public void OnGUI ();
private void OnGUIDialog (int windowId);
protected virtual void SendCancelResult ();
protected virtual void SendErrorResult (string error$$anonymous$$essage);
protected abstract void SendSuccessResult ();
public void Start ();
}
}
As I see the OnGUI function empty!
Do I paste the content you mentioned above, in there? or this is an another case?