So I have a canvas which doesnt get destroyed because it holds and slider whih shows a progressbar. It also has a button which is interactable when the progress of loading is 0.9.. The problem i am having is when I click the button (see activateNewScene()). Basically what happens is when I click on the button is that i load my scene and my disable my canvas. But the problem is that after I disable my canvas the old scene is still shown for about 0.5 sec and than the new scene is loaded. What I want is that after the canvas gets disabled the new scene should show up. without seeing the old scene for short time.

```
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;

 public class SceneLoaderGameObject : MonoBehaviour {

 private SceneLoader sl;
 public Canvas cav;

 void Start () {
     sl = new SceneLoader ();
     cav.GetComponent<Canvas> ().enabled = false;
     DontDestroyOnLoad (this.gameObject);
     DontDestroyOnLoad (cav.transform.parent);
 }

 public void setNewNameAndLoadScene(string name){

     if (cav != null) {
         Slider slid = cav.transform.GetChild (1).GetComponent<Slider> ();
         Text tx = cav.transform.GetChild (2).GetComponent<Text> ();
         Button bttn = cav.transform.GetChild (3).GetComponent<Button> ();

         sl.setNewScene (name);
         sl.setSliderAndTextToChange (slid, tx);
         bttn.onClick.AddListener (() => activateNewScene ());
         cav.GetComponent<Canvas> ().enabled = true;
         cav.GetComponent<Canvas> ().sortingOrder = 1;

         StartCoroutine (sl.LoadAsynchron (name, bttn));

     }

 }

 public void  activateNewScene(){
     sl.AsgetOP().allowSceneActivation=true;
     cav.GetComponent<Canvas> ().sortingOrder = 1;
     cav.GetComponent<Canvas> ().enabled = false;
 }

}

```

EDIT: Here is the code which loads the scene:

```
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class SceneLoader {

AsyncOperation operation;
string sceneName;
private Text txx =null;
private Slider slider=null;

public SceneLoader(){

}

public void setSliderAndTextToChange(Slider sl, Text tx){
    txx = tx;
    slider = sl;
}

public void setNewScene(string sceneName){

    if (sceneName.Length == 0) {
        throw new UnityException ("Please enter a name");
    }

    this.sceneName = sceneName;

}

public IEnumerator LoadAsynchron(string myMain, Button bttn){

    operation = SceneManager.LoadSceneAsync (myMain);
    operation.allowSceneActivation = false;
    while (operation.isDone == false) {
        float progress = Mathf.Clamp01 (operation.progress / 0.9f);
        slider.value = progress;
        txx.text = progress * 100f + " %";
        if (progress * 100f == 100f) {
            bttn.interactable = true;
        }
        yield return null;
    }
}

public AsyncOperation AsgetOP(){
    return operation;
}

}

```