Author Topic: Disabling ngui colliders while facebook post to feed is open  (Read 2078 times)

firestorm

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Disabling ngui colliders while facebook post to feed is open
« on: April 10, 2015, 02:30:58 AM »
I'm running into an issue where you are still able to interact with NGUI buttons while the post to facebook dialog box is open.

Unfortunately there is nothing in the hierachy that facebook creates while this dialog box is open so i am unable to do a simple if ... is there then change alpha.

The only thing i can see that facebook adds is under the hierarchy it creates a UnityFacebookSDKPlugin and in that inspector a feed dialog will appear. Screenshot provided.

It seems to run off a .dll file so cant do simple if statements there.

We can disable the buttons after you click share but have no way of re enabling them once the user has shared or cancelled the post.

If there is a way to get component of the feed dialog that would work nicely but a simple getcomponent<FeedDialog> doesnt work

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Disabling ngui colliders while facebook post to feed is open
« Reply #1 on: April 12, 2015, 04:25:22 PM »
To disable events, just disable the UICamera script. That's where the events are coming from.

That, or just put a full-screen UIWidget with a collider on it so that it intercepts the events.

firestorm

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: Disabling ngui colliders while facebook post to feed is open
« Reply #2 on: April 15, 2015, 08:15:17 PM »
That was the solution we were going to go with, the issue ended up been on the Facebook SDK side and had nothing to do with NGUI.
The issue was working out when the facebook UI was on screen.

So, if anyone else runs into this issue.
The fix was to use a callback from FBResult. A complete oversight on my behalf when learning about the facbook SDK.
For example I had to set up a function like this.

  1.  void LogCallBack(FBResult result)
  2.      {
  3.          if (result.Error != null)
  4.          {
  5.                  Debug.Log("ERROR IN FEED");
  6.                  sm.butCover.SetActive (false);
  7.          }
  8.              else
  9.  
  10.              {
  11.                  Debug.Log("SUCCESS IN FEED");
  12.                  sm.butCover.SetActive (false);
  13.              }
  14.          }

And then at after you call your FB.Feed you use the callback which sends information back regarding the facebook UI (from my understanding)

  1.  else
  2.          {
  3.  
  4.              sm.butCover.SetActive (true);
  5.              FB.Feed (
  6.              linkCaption: "", //share with friends at anytime.
  7.              picture: "", //http to game icon to be shown on facebook.
  8.              linkName: "", //just the name of the link
  9.              link: "http://apps.facebook.com/" + FB.AppId + "/?challenge_brag=" + (FB.IsLoggedIn ? FB.UserId : "guest"),
  10.                  callback: LogCallBack
  11.              );
  12. }

So if you press share or cancel it will indicate that the callback was a success.

FYI sm.butCover.SetActive is just a panel that covers the screen which I am turning on or off to block interaction with the game while the FB UI is up on screen.