在AWake中调用加载场景的问题

public class TestLauncher : MonoBehaviour {

   void Awake(){
    //StartCoroutine (StartLoading()); //放在此处调用,则op.allowSceneActivation = true;   不会起作用。
   }
  // Use this for initialization
   void Start () {
      StartCoroutine (StartLoading()); //放在此处则可以正常执行
   }

    private IEnumerator StartLoading() {

    while (!SplashScreen.isFinished) {
        yield return new WaitForEndOfFrame ();
    }
    
    AsyncOperation op = SceneManager.LoadSceneAsync (1);
    op.allowSceneActivation = false;
    while(op.progress<0.89f) {
        yield return new WaitForEndOfFrame();
    }
    op.allowSceneActivation = true;
  }
 }

你可能感兴趣的:(在AWake中调用加载场景的问题)