SHARE
TWEET

Untitled

a guest Dec 15th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class StartScript : MonoBehaviour {
  2.  
  3. void Start () {
  4.  
  5.  
  6.     FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("my_url");
  7.    FirebaseDatabase.DefaultInstance
  8.   .GetReference("/")
  9.   .GetValueAsync().ContinueWith(task => {
  10.       if (task.IsFaulted)
  11.       {
  12.           // Handle the error...
  13.       }
  14.       else if (task.IsCompleted)
  15.       {
  16.           DataSnapshot snapshot = task.Result;
  17.           // Do something with snapshot...
  18.           if (snapshot.Value.Equals("none")) {
  19.               SceneManager.LoadScene(1);
  20.           }
  21.       }
  22.   });
  23.  
  24.  
  25. }
  26.  
  27.  
  28. void Update () {
  29.  
  30. }
  31.    
  32. public class StartScript : MonoBehaviour {
  33. bool check = false;
  34. string link = "";
  35. // Use this for initialization
  36. void Start () {
  37.     FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("myurl");
  38.     FirebaseDatabase.DefaultInstance
  39.     .GetReference("/")
  40.     .GetValueAsync().ContinueWith(task => {
  41.         if (task.IsFaulted){
  42.  
  43.         }
  44.         else if (task.IsCompleted)
  45.         {
  46.             DataSnapshot snapshot = task.Result;
  47.  
  48.             link = snapshot.Value.ToString();
  49.             }
  50.         check = true;
  51.  
  52.     });
  53. }
  54.  
  55. // Update is called once per frame
  56. void Update () {
  57.     if (check == true) {
  58.         if (link.Equals("none")) {
  59.             SceneManager.LoadScene("Scene1");
  60.         }
  61.  
  62.     }
  63. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top