FlaShG / GitMerge-for-Unity

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

Fail to merge number of game object #32

Closed tsubaki closed 9 years ago

tsubaki commented 9 years ago

what happen

GitMarge say error message : ArgumentException: An element with the same key already exists in the dictionary.

how to reproduce

unity 4.6 / 5 Create a new gameobject in scene , then marge.

image

errormessage

ArgumentException: An element with the same key already exists in the dictionary.
System.Collections.Generic.Dictionary`2[System.Int32,UnityEngine.Object].Add (Int32 key, UnityEngine.Object value) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404)
GitMerge.ObjectDictionaries.AddOurObject (UnityEngine.Object o) (at Assets/Editor/ObjectDictionaries.cs:42)
GitMerge.ObjectDictionaries.SetAsOurObject (UnityEngine.GameObject go) (at Assets/Editor/ObjectDictionaries.cs:31)
GitMerge.GitMergeWindow.SetAsOurObjects (System.Collections.Generic.List`1 objects) (at Assets/Editor/GitMergeWindow.cs:425)
GitMerge.GitMergeWindow.InitializeSceneMerging () (at Assets/Editor/GitMergeWindow.cs:300)
GitMerge.GitMergeWindow.OnGUISceneTab () (at Assets/Editor/GitMergeWindow.cs:155)
GitMerge.GitMergeWindow.OnGUI () (at Assets/Editor/GitMergeWindow.cs:132)
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)
FlaShG commented 9 years ago

This message occurs when an object has never been saved in the current scene. I'll add a forced scene save to prevent this from happening.

clabe45 commented 5 years ago

On Unity 2018, I didn't make any changes in my scene, and I still got the error. I even saved it and then ran it, with the same error.

ArgumentException: An item with the same key has already been added. Key: 0
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
GitMerge.ObjectDictionaries.AddOurObject (UnityEngine.Object o) (at Assets/3rd-Party/GitMerge-for-Unity/Editor/ObjectDictionaries.cs:68)
GitMerge.ObjectDictionaries.SetAsOurObject (UnityEngine.GameObject go) (at Assets/3rd-Party/GitMerge-for-Unity/Editor/ObjectDictionaries.cs:54)
GitMerge.ObjectDictionaries.SetAsOurObjects (System.Collections.Generic.List`1[T] objects) (at Assets/3rd-Party/GitMerge-for-Unity/Editor/ObjectDictionaries.cs:36)
GitMerge.MergeManagerScene.InitializeMerge () (at Assets/3rd-Party/GitMerge-for-Unity/Editor/MergeManagerScene.cs:37)
GitMerge.GitMergeWindow.OnGUISceneTab () (at Assets/3rd-Party/GitMerge-for-Unity/Editor/GitMergeWindow.cs:128)
GitMerge.GitMergeWindow.OnGUI () (at Assets/3rd-Party/GitMerge-for-Unity/Editor/GitMergeWindow.cs:104)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:310)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean customBorder, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:361)
UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:320)
UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:266)
UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:438)
UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:421)
UnityEngine.Experimental.UIElements.IMGUIContainer.HandleEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:401)
UnityEngine.Experimental.UIElements.EventDispatcher.ProcessEvent (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:511)
UnityEngine.Experimental.UIElements.EventDispatcher.Dispatch (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:307)
UnityEngine.Experimental.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.Experimental.UIElements.EventBase e, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:176)
UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:245)
UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
FlaShG commented 5 years ago

@clabe45 Do you have two or more prefabs in your scene?

clabe45 commented 5 years ago

@FlaShG Yes

FlaShG commented 5 years ago

@clabe45 Please refer to the readme and #17. In short: This tool doesn't work with prefab instances in scenes. Hasn't since Unity 5.

clabe45 commented 5 years ago

Ah thank you. Since Unity 5 is old, maybe you should change the message in the readme to "Unity 5 and later" so people don't get confused 🦊

FlaShG commented 5 years ago

Why not!