示例#1
0
        public IEnumerator MergeAsync(string myPath, string theirPath)
        {
            if (string.IsNullOrEmpty(myPath) || string.IsNullOrEmpty(theirPath))
            {
                yield break;
            }

            if (myPath.EndsWith("prefab") || theirPath.EndsWith("prefab"))
            {
                PrefabMerge(myPath, theirPath);
                yield break;
            }

            if (AssetDatabase.LoadAssetAtPath(myPath, typeof(UnityObject)) &&
                AssetDatabase.LoadAssetAtPath(theirPath, typeof(UnityObject)))
            {
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
                if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
                {
#else
                if (EditorApplication.SaveCurrentSceneIfUserWantsTo())
                {
#endif

                    var enumerator = CollectSceneSettings(myPath, theirPath);
                    while (enumerator.MoveNext())
                    {
                        yield return(null);
                    }

                    MergeScenes(myPath, theirPath);

                    RecaptureSettings();

                    enumerator = Refresh();
                    while (enumerator.MoveNext())
                    {
                        yield return(null);
                    }

                    yield return(null);

                    var objectMerge = (ObjectMerge)GetWindow(typeof(ObjectMerge));
                    var root        = objectMerge.root;
                    root.SetGameObjects(myContainer, theirContainer);
                    objectMerge.update     = root.Refresh();
                    objectMerge.sceneMerge = this;
                    objectMerge.Repaint();
                    yield return(null);

                    merged = true;
                }
            }
            loading = false;
        }