Search Unity

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:
    782
    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:
    38,691
    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.