ArgumentException: An item with the same key has already been added.

Issue #731 invalid
Kristaps Auzins created an issue
  1. Wanted to add a script to Script Execution Order, but the add button throws an error:
    ArgumentException: An item with the same key has already been added.
  2. Just click the add script button at the bottom in Script Execution Order.

  3. The screenshot above ☝

  4. Unity 2020.2.0f1
  5. Odin 3.0.2.0
  6. Yes
  7. macOS High Sierra

Comments (7)

  1. Tor Esa Vestergaard

    As this is a Unity window controlling Unity options, rendered by Unity, with no Odin functionality or Odin-related anything anywhere, I'm afraid this is not an issue with Odin Inspector, and we cannot help you with it.

  2. Kristaps Auzins reporter

    This bug is related to Odin Inspector!
    If I remove the Odin Inspector or create an empty project, that button works.
    As soon Odin Inspector gets added, it breaks!

  3. Max Tratnik

    I got the same issue and can confirm what Kristaps reported. I'm using version 3.0.3 (from Dec 18).
    I’m posting the stack-trace here. I hope this helps in fixing it.

    My Stacktrace:

    ArgumentException: An item with the same key has already been added. Key: Assets/Plugins/Sirenix/Assemblies/Sirenix.OdinInspector.Editor.dll.meta
    System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <9577ac7a62ef43179789031239ba8798>:0)
    System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <9577ac7a62ef43179789031239ba8798>:0)
    UnityEditor.ScriptExecutionOrderInspector.ShowScriptPopup (UnityEngine.Rect r) (at <fac3a832ec4249a49c4da1051848dde5>:0)
    UnityEditor.ScriptExecutionOrderInspector.OnInspectorGUI () (at <fac3a832ec4249a49c4da1051848dde5>:0)
    UnityEditor.AssetSettingsProvider.OnGUI (System.String searchContext) (at <fac3a832ec4249a49c4da1051848dde5>:0)
    UnityEditor.SettingsWindow.DrawControls () (at <fac3a832ec4249a49c4da1051848dde5>:0)
    UnityEditor.SettingsWindow.DrawSettingsPanel () (at <fac3a832ec4249a49c4da1051848dde5>:0)
    UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToRegularTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.EventDispatcher.OpenGate () (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <a8eb1be68acb4659af00824c7808e2c0>:0
    

  4. Tor Esa Vestergaard

    Hmm. While Odin’s mere existence might be the triggering factor, we cannot really fix the fact of Odin existing - this is a Unity issue that they must have introduced recently, and should be reported to Unity with reproduction steps by those who can reproduce it.

    I have attempted to reproduce this issue in Unity 2020.2.0f1 on Odin versions 3.0.2 and 3.0.3, and could not reproduce the issue in either case. I can add, remove and reorder scripts in the Script Execution Order. Therefore I’m afraid I cannot report the issue, so one or both of you will have to do so, so Unity can get on fixing it :)

  5. Log in to comment