0

I have been working with firebase authentication and been getting thrown this error.

NullReferenceException: Object reference not set to an instance of an object

At the start of my code, I define auth with

Firebase.Auth.FirebaseAuth auth = Firebase.Auth.FirebaseAuth.DefaultInstance;

and this is my main chunk of firebase code

    public void FirebaseInfo()
    {
      email = m_Emailadress.ToString();
      password = m_RegisterPassword.ToString();
      auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task => {
        if (task.IsCanceled) {
          Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
          return;
        }
        if (task.IsFaulted) {
          Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
          return;
        }

        // Firebase user has been created.
        Firebase.Auth.FirebaseUser newUser = task.Result;
          Debug.LogFormat("Firebase user created successfully: {0} ({1})",
            newUser.DisplayName, newUser.UserId);
        });

Have I failed to add something in the unity editor or am I writing something wrong in my code?

0 Answers0