unity, LoadLevelAdditive到帧末才完成

Application.LoadLevelAdditive文档中说:

LoadLevel and LoadLevelAdditive don't happen immediately - a new level is loaded after the current game frame finishes. isLoadingLevel returns true if a level load was requested this frame already.

 

即LoadLevelAdditive到帧末才完成,所以要想获得新load进来的场景中的节点,不能立即find,可用Application.isLoadingLevel来判断load是否完成。如下所示:

Application.LoadLevelAdditive (sceneName);
while(Application.isLoadingLevel==true){
  yield return null;
}//loading done

Transform sceneRoot = GameObject.Find(sceneRootName);

 

posted on 2016-06-26 01:20  wantnon  阅读(1022)  评论(0编辑  收藏  举报

导航