Facebook integration problem

I’ve been trying to integrate facebook into my project and I’ve successfully managed to do just that with the help of some online tutorials however I do have one persisting problem…

The code is set to pause the game using

Time.timescale = 0; when a facebook window is up and to resume play using
Time.timescale = 1; when it’s not

but that just doesn’t happen, and the function that pauses the game never gets called…

Here’s the code :

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;

public class FBHolder : MonoBehaviour {

	public GameObject UIFBIsLoggedIn;
	public GameObject UIFBNotLoggedIn;
	public GameObject UIFBAvatar;
	public GameObject UIFBUserName;
	

	public GameObject ScoreEntryPanel;
	public GameObject ScoreScrollList;

	private List<object> scoreslist = null;

	private Dictionary<string, string> profile = null;

	void Awake()
	{
		FB.Init (SetInit, onHideUnity);
	}

	private void SetInit()
	{
		Debug.Log ("FB Init Done");

		if(FB.IsLoggedIn)
			{
				Debug.Log ("FB Logged In");
				managefbmenus(true);
			}
		else
			{
				managefbmenus(false);
			}

	}

	private void onHideUnity(bool isGameShown)
	{
		if(!isGameShown)
			{
				Debug.Log ("Pause Game");
				Time.timeScale = 0;
			}
		else
			{
				Time.timeScale = 1;
			}
	}

	public void FBLogin()
	{
		FB.Login ("email,publish_actions", Authcallback);
	}

	void Authcallback(FBResult result)
	{
		if(FB.IsLoggedIn)
			{
				Debug.Log ("FB Login Worked");
				managefbmenus(true);
			}
		else
			{
				Debug.Log ("FB Login Failed");
				managefbmenus(false);
			}
	}

	void managefbmenus(bool isLoggedIn)
	{
		if(isLoggedIn)
			{
				UIFBIsLoggedIn.SetActive(true);
				UIFBNotLoggedIn.SetActive(false);
				SetScore();

				//Get profile picture
				FB.API(Util.GetPictureURL("me", 128, 128), Facebook.HttpMethod.GET, DealWithProfilePicture);
				FB.API("/me?fields=id,first_name", Facebook.HttpMethod.GET,DealwithUserName);
				//Get username
			}
		if(!isLoggedIn)
			{
				UIFBIsLoggedIn.SetActive(false);
				UIFBNotLoggedIn.SetActive(true);
			}
	}


	void DealWithProfilePicture(FBResult result)
	{
		if(result.Error != null)
		{
			Debug.Log ("Problem getting profile picture");
			FB.API(Util.GetPictureURL("me", 128, 128), Facebook.HttpMethod.GET, DealWithProfilePicture);
			return;
		}
		Image UserAvatar = UIFBAvatar.GetComponent<Image> ();
		UserAvatar.sprite = Sprite.Create (result.Texture, new Rect(0, 0, 128, 128), new Vector2(0, 0));
	}

	void DealwithUserName(FBResult result)
	{
		if(result.Error != null)
		{
			Debug.Log ("Problem getting username");
			FB.API("/me?fields=id,first_name", Facebook.HttpMethod.GET,DealwithUserName);
			return;
		}
		profile = Util.DeserializeJSONProfile(result.Text);

		Text UserMsg = UIFBUserName.GetComponent<Text>();

		UserMsg.text = "Hello, " + profile ["first_name"];
	}

Any ideas on what could be causing this issue?

BTW: I’m using unity 5.

Here’s what I did. Inside the function FBLogin() i set the timescale to 0. Then on the call back i set the timescale back to 1.