Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Scenes not loading after Firebase Auth

Discussion in 'Scripting' started by Seaworth, Oct 6, 2019.

  1. Seaworth

    Seaworth

    Joined:
    Aug 15, 2019
    Posts:
    19
    Hi folks,

    I have this code which is working with regards to the Firebase side, but is not loading scenes. Any ideas would be greatly appreciated.
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.SceneManagement;
    5. using UnityEngine.UI;
    6. using Firebase;
    7. using Firebase.Auth;
    8. //using Firebase.Unity.Editor;
    9.  
    10.  
    11. public class LoginScreenScript : MonoBehaviour
    12. {
    13.     public InputField emailAddress, password;
    14.     // Start is called before the first frame update
    15.     public void LoginPressed()
    16.     {
    17.         Debug.Log("Login pressed");
    18.         FirebaseAuth.DefaultInstance.SignInWithEmailAndPasswordAsync(emailAddress.text, password.text).ContinueWith((obj) =>
    19.        {
    20.             SceneManager.LoadScene("Menu Screen");
    21.         });
    22.     }
    23.  
    24.     public void RegisterPressed()
    25.     {
    26.         Debug.Log("Register Pressed");
    27.         FirebaseAuth.DefaultInstance.CreateUserWithEmailAndPasswordAsync(emailAddress.text, password.text).
    28.             ContinueWith((obj) =>
    29.             {
    30.                 SceneManager.LoadSceneAsync("Personal Details Screen");
    31.             });
    32.     }
    33. }
    34.  
     
  2. Seaworth

    Seaworth

    Joined:
    Aug 15, 2019
    Posts:
    19
     
  3. Seaworth

    Seaworth

    Joined:
    Aug 15, 2019
    Posts:
    19
    I noticed that after I Login or Register a new scene appears call DontDestroyOnLoad as per image below:
    PostAuth.png
     
  4. nileshsrox

    nileshsrox

    Joined:
    Nov 24, 2016
    Posts:
    1
    found any solution yet?