Author Topic: NGUI Buttons stop sending OnClick Notify after the Facebook Canvas closes  (Read 1711 times)

maxhap

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 9
    • View Profile
Hi guys, hoping you can help with this. This is for an Android build

I am currently developing a game that uses the Unity Facebook SDK to send feeds to the users wall. This process is started with the push of a NGUI button. After the button is pressed the Facebook API takes over and proceeds to log the user in and post to facebook using their own canvas overlay. However once the canvas closes NGUI buttons stop sending OnClick Notifications to my scripts, the game is running fine, buttons change their shading/tint when pressed and I can pragmatically change NGUI labels text (used when trying to debug on device).

Now the Facebook SDK only works when built to an android or IOS device so debugging this is proving tricky and I have hit a wall.

Would you guys happen to be able to think of some things I might try, I'm stumped.

Thanks

maxhap

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 9
    • View Profile
Fixed this issue, I tracked it down to the current never being null within the OnClick function. This was due to me originally launching the Facebook SDK from an NGUI button click. The Facebook SDK was thrown an exception (only when built to my tablet so not obviously visible) thus crashing the call stack early so current = null was never being reached. Thus stopping future buttons from working.

   protected virtual void OnClick ()
    {
      if (current == null && isEnabled)
      {
         current = this;
         EventDelegate.Execute(onClick);
         current = null;
      }
}