Problem shortcut: unity ui doesn't respond to code after I logged in with firebaseAuth.
The question is: how can I make changes to unity ui after I connected to firebaseAuth ?
Problem details: i have made a firebase auth system and it works fine and all massages was printed fine in system.print() but when i need to desplay the Auth error in UI.text its not working even after the login in success and i want to change scene to make player enter the game it the SceneManager.loadscene() didnt work..
this is my code:
using UnityEngine;
using UnityEngine.UI;
using Firebase.Auth;
public class AccountsManager : MonoBehaviour
{
public void Login()
{
if (Email.text == "" && Password.text == "")
{
LoginMassageText.text = "Enter Email and Password";
}
else if (Email.text == "")
{
LoginMassageText.text = "Enter Email";
}
else if (Password.text == "")
{
LoginMassageText.text = "Enter Password";
}
else
{
FirebaseAuth.DefaultInstance.SignInWithEmailAndPasswordAsync(Email.text, Password.text).ContinueWith((task =>
{
if (task.IsCanceled)
{
Firebase.FirebaseException e = task.Exception.Flatten().InnerExceptions[0] as Firebase.FirebaseException;
ErroeHundler((AuthError)e.ErrorCode);
Debug.Log("1" + e);
return;
}
else if (task.IsFaulted)
{
Firebase.FirebaseException e = task.Exception.Flatten().InnerExceptions[0] as Firebase.FirebaseException;
ErroeHundler((AuthError)e.ErrorCode);
return;
}
else if (task.IsCompleted)
{
Debug.Log("login successful");
return;
}
}));
}
}
void ErroeHundler(AuthError Error)
{
print(Error.ToString());
LoginMassageText.text = "Invalid Email"; //this not working
switch(Error)
{
case AuthError.InvalidEmail:
LoginMassageText.text = "Invalid Email"; //this not working
print("invild");
break;
case AuthError.MissingEmail:
LoginMassageText.text = "Invalid Email"; //this not working
print("missingemail");
break;
default:
LoginMassageText.text = "Invalid Email"; //this not working
break;
}
}