Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Double scene loading instead of one.

Discussion in 'Scripting' started by DDDimanN79, Mar 25, 2020.

  1. DDDimanN79

    DDDimanN79

    Joined:
    May 30, 2014
    Posts:
    6
    Greetings! I use LoadSceneAsync to load game scenes and sometimes instead of a single scene 2 is loaded, which makes such a scene unplayable. No pattern of double scene loading is observed, this phenomenon is completely random. Perhaps someone has encountered this bug and can not help?
     
  2. arfish

    arfish

    Joined:
    Jan 28, 2017
    Posts:
    777
    How about a check before loading a scene? like:
    If (!(sceneIsLoaded || sceneIsLoading)) { LoadSceneAsync(scene);}
     
    DDDimanN79 likes this.
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,971
    Put a Debug.Log() at any location where you call LoadSceneAsync().

    Run until you see the double scene. Did you see double calls to LoadSceneAsync?
     
    DDDimanN79 likes this.
  4. DDDimanN79

    DDDimanN79

    Joined:
    May 30, 2014
    Posts:
    6
    Thank you guys so much! Your advice helped solve the problem!
     
    Kurt-Dekker likes this.