public void Login()
{
#if (UNITY_IPHONE || UNITY_ANDROID)
if (!Social.localUser.authenticated) {
busy = true;
try{
Social.localUser.Authenticate((bool success) => {
if (success){
//Automatically log in in the future
PlayerPrefs.SetInt("auto_login", 1);
}
else{
//Login failed, don't try again unless the player asks
PlayerPrefs.SetInt("auto_login", 0);
}
busy = false;
UpdateButton();
});
}
catch(Exception){
//Exception is thrown when failing to call into the plugin code
busy = false;
UpdateButton();
}
}
else{
UpdateButton();
}
#endif
}