IEnumerator _EnterScene(int sceneID) { var newBehavior = GetBehavior(sceneID); if (newBehavior == null) { yield break; } if (curScene != null) { curScene.LeaveScene(); //销毁上一个场景 if (model.Cur_Data != null && tf_parent) { var last = tf_parent.gameObject.FindChild(model.Cur_Data.name); GameObject.Destroy(last); } } //加载新场景 if (!DB.SceneBaseMap.ContainsKey(sceneID)) { Log.Error($"sceneID:{sceneID} ,配置表中不存在"); yield break; } yield return(MyTask.Call(BuildScene(DB.SceneBaseMap[sceneID]))); curScene_id = sceneID; curScene = newBehavior; curScene.EnterScene(); }