- Home /
Unity and FaceBook. OnHideUnity not being called.
Hello ^-^
I've tried to add some facebook functionalities to my game (just trying to log for now ^-^ ), and despite the diferent tests i'm making, it seems that the function onHideUnity is never called.
As far as i could understand, that function should be called each time that a FaceBook popup appear, isn't it?
So far the code i have for facebook looks like this:
using UnityEngine;
using System.Collections;
public class FBControl : MonoBehaviour {
private bool onFB;
public void Awake() {
enabled = false;
// if(!FB.IsInitialized) {
FB.Init(onInitComplete, onHideUnity);
//}
}
private void onInitComplete() {
enabled = true;
Debug.Log (enabled);
}
private void onHideUnity(bool isGameShown) {
Debug.Log ("onHideUnity()");
if(!isGameShown) {
Time.timeScale = 0;
onFB = true;
} else {
Time.timeScale = 1;
onFB = false;
}
}
private void callback(FBResult result) {
if(FB.IsLoggedIn) {
// Debug.Log (FB.UserId);
} else {
// Debug.Log ("Cancel");
}
}
public bool isOnFB() {
return onFB;
}
public void login() {
FB.Login("email, publish_actions", callback);
}
public void logout() {
FB.Logout();
}
}
I wanted to use the onFB bool to disable elemnts from the UI when the facebook button is pressed (button related with the login function), and then check for it to enable the UI afterwards.
When i press the button the popup appears, but i can still press the rest of UI buttons through it, adding the log to the function i could see that it's never called :/
I don't know if i'm doing it right, in the api looks similar. Does someone know why could this happen? :/
Thank you in advance.
Hello, did You managed to solve the issue? Regards, $$anonymous$$arcin.
Your answer
Follow this Question
Related Questions
Norton detects UnityWebPlayer as security risk 1 Answer
Connecting to internet slows down my game? 1 Answer
Post screenshot photo on facebook 1 Answer
Facebook app invitation in android 0 Answers
Facebook app invitation in android -1 Answers