private IEnumerator CoCreatePrefab(ProjectItem dropTarget, byte[][] previewData, object[] objects, Action <AssetItem[]> done) { if (objects.Any(o => !(o is GameObject))) { IsBusy = true; if (dropTarget.Children == null || dropTarget.Get("DropTarget/Data") == null) { ProjectAsyncOperation createFoldersAo = m_project.CreateFolder(dropTarget.Get("DropTarget/Data", true)); yield return(createFoldersAo); if (createFoldersAo.HasError) { m_wm.MessageBox("Unable to create data folder", createFoldersAo.Error.ToString()); IsBusy = false; if (done != null) { done(null); } yield break; } } IProjectTree projectTree = IOC.Resolve <IProjectTree>(); if (projectTree != null) { projectTree.SelectedItem = dropTarget; } } IsBusy = true; ProjectItem dataFolder = dropTarget.Get("DropTarget/Data"); List <ProjectItem> parents = new List <ProjectItem>(); for (int i = 0; i < objects.Length; ++i) { object obj = objects[i]; if (obj is GameObject) { parents.Add(dropTarget); } else { parents.Add(dataFolder); } } ProjectAsyncOperation <AssetItem[]> saveAo = m_project.Save(parents.ToArray(), previewData, objects, null); yield return(saveAo); if (saveAo.HasError) { m_wm.MessageBox(m_localization.GetString("ID_RTEditor_UnableToCreatePrefab", "Unable to create prefab"), saveAo.Error.ErrorText); IsBusy = false; if (done != null) { done(null); } yield break; } IsBusy = false; if (done != null) { done(saveAo.Result.ToArray()); } }