public void UpdateState() { try { if (CurrentBaker != null) { if (CurrentBaker.IsInProgress()) { CurrentBaker.UpdateState(); if (CurrentBaker.IsCancelled) { throw new Exception("Cancelled"); } return; } else { EditorUtility.ClearProgressBar(); ModelIndex++; } } Model model = NextModel(); if (model != null) { string sIndex = ""; if (modelList.Count > 1) { sIndex = ModelIndex.ToString().PadLeft((modelList.Count + 1).ToString().Length, '0'); } for (int i = 0; i < modelList.Count; ++i) { modelList[i].gameObject.SetActive(false); } model.gameObject.SetActive(true); if (Model.IsMeshModel(model)) { MeshModel meshModel = Model.AsMeshModel(model); List <MeshAnimation> validAnimations = meshModel.GetValidAnimations(); if (validAnimations.Count > 0) { CurrentBaker = new MeshBaker(model, validAnimations, studio, sIndex, batchingFolderPath); } else { CurrentBaker = new StaticBaker(model, studio, sIndex, batchingFolderPath); } } else if (Model.IsParticleModel(model)) { CurrentBaker = new ParticleBaker(model, studio, sIndex, batchingFolderPath); } } else { EditorUtility.FocusProjectWindow(); if (needPassingFinalUpdate) { needPassingFinalUpdate = false; return; } Finish(); } } catch (Exception e) { Debug.LogException(e); Finish(); } }