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

Question SceneManager not working.

Discussion in 'Scripting' started by grg_Biki53, Jul 3, 2020.

  1. grg_Biki53

    grg_Biki53

    Joined:
    Jan 20, 2020
    Posts:
    3
    Code (CSharp):
    1.  
    2. auth.SignInWithCredentialAsync(credential).ContinueWith(task =>
    3.                 {
    4.                     if (task.IsCanceled)
    5.                     {
    6.                         Debug.LogError("SignInWithCredentialAsync was canceled.");
    7.                         return;
    8.                     }
    9.                     else if (task.IsFaulted)
    10.                     {
    11.                         Debug.LogError("SignInWithCredentialAsync encountered an error: " + task.Exception);
    12.                         return;
    13.                     }
    14.                     else if (task.IsCompleted)
    15.                     {
    16.                         SceneManager.LoadScene(1);
    17.                     }
    18.                 });
    I've been trying to integrate google authentication in my game and i want to start another scene after task is completed but scene manager doesn't seem to work inside this async function. Am I not supposed to loadscene inside async function?
     
  2. Zer0Cool

    Zer0Cool

    Joined:
    Oct 24, 2014
    Posts:
    203
  3. grg_Biki53

    grg_Biki53

    Joined:
    Jan 20, 2020
    Posts:
    3
  4. grg_Biki53

    grg_Biki53

    Joined:
    Jan 20, 2020
    Posts:
    3