FlaShG / GitMerge-for-Unity

Unity plugin for merging sceneand prefabs files when using git.
GNU General Public License v2.0
201 stars 27 forks source link

Exception when changing scene while merging #50

Open narlee opened 9 years ago

narlee commented 9 years ago

when you start merging - opening new scene (also on merge prefab), but when you change scene before finish merge (fix or abort) and then click 'abort merge' or smth. else -> unity thrown this:

MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. GitMerge.MergeAction.RefreshPrefabInstance () (at Assets/Editor/MergeAction.cs:94) GitMerge.MergeAction.UseOurs () (at Assets/Editor/MergeAction.cs:55) GitMerge.GameObjectMergeActions.UseOurs () (at Assets/Editor/GameObjectMergeActions.cs:254) GitMerge.MergeManager.AbortMerge () (at Assets/Editor/MergeManager.cs:114) GitMerge.MergeManagerPrefab.AbortMerge () (at Assets/Editor/MergeManagerPrefab.cs:129) GitMerge.GitMergeWindow.DrawTabButtons () (at Assets/Editor/GitMergeWindow.cs:220) GitMerge.GitMergeWindow.OnGUI () (at Assets/Editor/GitMergeWindow.cs:115) System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

*needed to check is opened merging scene!

FlaShG commented 9 years ago

Related: http://answers.unity3d.com/questions/283191/how-do-i-detect-if-a-scene-is-being-loaded-during.html Or try [ExecuteInEditMode] with OnLevelWasLoaded.