Hello, I have a problem where I’ve set up a simple event when google authenticates, like so:
public class GoogleStuff : MonoBehaviour {
public delegate void GoogleLogin();
public static event GoogleLogin OnGoogleLogin;
void OnEnable (){
PlayGamesPlatform.Activate();
PlayGamesPlatform.DebugLogEnabled = true;
}
void Awake () {
Social.Active.localUser.Authenticate ((bool success) => {
if(success){
Debug.Log("Authetication Success");
} else {
Debug.Log("Authetication Failed");
}
});
if(OnGoogleLogin != null){
print ("firing event");
OnGoogleLogin();
}
}
}
and I’ve subscribed an to the event with:
void OnEnable (){
GoogleStuff.OnGoogleLogin += ActivatePlayer;
}
void ActivatePlayer (){
print ("Event recieved");
UserName = Social.Active.localUser.userName;
LoadPlayerData ();
}
The ActivatePlayer function is not being called even though I’m getting the “fired event” log from the login. I assume I’ve done something wrong but I can’t seem to find the right answer. Thanks for all the help.
~ Soos