Demigiant / dotween

A Unity C# animation engine. HOTween v2
http://dotween.demigiant.com
Other
2.29k stars 345 forks source link

Script Execution Order error: An item with the same key has already been added. Key: DOTween.dll.meta #453

Open AntonPetrov83 opened 3 years ago

AntonPetrov83 commented 3 years ago

Hi 👋

It is not possible to add a new script to the Script Execution Order list via Plus button on the bottom. The popup window gets broken by an exception:

ArgumentException: An item with the same key has already been added. Key: Assets/_Plugins/DOTween/DOTween.dll.meta
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <fb001e01371b4adca20013e0ac763896>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <fb001e01371b4adca20013e0ac763896>:0)
UnityEditor.ScriptExecutionOrderInspector.ShowScriptPopup (UnityEngine.Rect r) (at <d1bec46880064709a5e713ad543e6d96>:0)
UnityEditor.ScriptExecutionOrderInspector.OnInspectorGUI () (at <d1bec46880064709a5e713ad543e6d96>:0)
...

The same problem is mentioned here and here

This is a relevent Unity source file: ScriptExecutionOrderInspector.cs

Demigiant commented 3 years ago

Ahoy! :)

On what version of Unity are you? I tested on 2020.1.8f and I have no issues. This happens when you click the "+" button in the "Project Settings > Script Execution Order" panel, right?

I also checked Unity's ShowScriptPopup method, which is generating this error, and it seems in your case it finds a duplicate of the same meta file in your project, and that causes its path dictionary to throw that error. I can confirm that DOTween does absolutely nothing with ScriptExecutionOrder, so it seems a weird Unity or project-related bug (also considering the first forum link has also other DLLs throw the same error), and unrelated to DOTween. Alternatively, there's some asset in your project that is doing "things" with the script execution order and is messing up Unity's.

Can you post a screenshot of your Script Execution Order panel? I'm curious to see what's in there.

Demigiant commented 3 years ago

P.S. If you expand the comments on the question here you will see that there's other users reporting the same error without DOTween in the project. From that and other answers it seems related to PlasticSCM causing these conflicts with random DLL files in your project (though another user has this happening without PlasticSCM either). Do you have PlasticSCM installed too?

AntonPetrov83 commented 3 years ago

On what version of Unity are you?

2020.1.2f1

This happens when you click the "+" button in the "Project Settings > Script Execution Order" panel, right?

Exactly.

Can you post a screenshot of your Script Execution Order panel? I'm curious to see what's in there.

image

Do you have PlasticSCM installed too?

Yes I have.

From that and other answers it seems related to PlasticSCM causing these conflicts with random DLL files in your project (though another user has this happening without PlasticSCM either).

A guy from comments here tells that he is using Git. Maybe it is a generic version control-related bug in Unity.

I will investigate into PlasticSCM. Thx

Demigiant commented 3 years ago

Let me know if you can. I'm marking this as "invalid" because it's not related to DOTween, but I'm curious to know more.

prakaz commented 3 years ago

I came across this same issue today. I am using 2020.2.0f1.

I don't have Plastic SCM installed. The only other plugin I have added to the project is Rainbow Folders 2.

So strange that DOTween is being dragged into this!

Demigiant commented 3 years ago

@prakaz What git system do you use? It might be because of that too. The problem is apparently Unity's ScriptExecutionOrder registering twice the same file (in this case DOTween, in other cases others), as if you had a "ghost" of it, so the second time it fails because it finds it already registered.

prakaz commented 3 years ago

@Demigiant Some of the scripts in my prototype project is on GitHub. I hope Unity will fixes this issue soon.

josephan commented 3 years ago

I've also faced this issue with 2020.2.0b14 and I'm using git for version control. A workaround is to just drag and drop a script.

Demigiant commented 3 years ago

@josephan Ah, this is a great workaround, which also marks this definitely as a Unity bug unrelated to other assets then. Very weird, but thank you for the tip!

wheee commented 3 years ago

Ran into the same issue with Dotween. Using 2020.2.0f1 Personal.

The workaround mentioned above works.

Also found this forum posting: https://forum.unity.com/threads/script-execution-order-plus-button-causes-error-from-assembly-meta-file.961950/

flo-wolf commented 3 years ago

Same problem for me when clicking the plus icon in 2020.2.0f1. Using Rainbow Folders 2, DoTween and Git version control. The workaround worked for me too.

Stacktrace:

ArgumentException: An item with the same key has already been added. Key: Assets/Plugins/Demigiant/DOTween/DOTween.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)
Xriuk commented 3 years ago

Same thing happened to me. No Plastic SCM installed, as mentioned above dragging and dropping the script works. But the problem stays, I think it is related to this plugin, because for many users it triggers the same exact message...

This is the list of the scripts:

immagine

And this is the log:

ArgumentException: An item with the same key has already been added. Key: Assets/Plugins/Demigiant/DOTween/DOTween.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)
ChalkX commented 3 years ago

I'm also having this issue. Same exact as OP.

MikeMnD commented 3 years ago

+1 Same problem on 2020.2.1f1 - Using the DoTweenPro package

ArgumentException: An item with the same key has already been added. Key: Assets/Plugins/Demigiant/DOTween/DOTween.dll.meta System.Collections.Generic.Dictionary2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <9577ac7a62ef43179789031239ba8798>:0) System.Collections.Generic.Dictionary2[TKey,TValue].Add (TKey key, TValue value) (at <9577ac7a62ef43179789031239ba8798>:0) UnityEditor.ScriptExecutionOrderInspector.ShowScriptPopup (UnityEngine.Rect r) (at <1e441e8684a14fe4b8f8a926d91afc3a>:0) UnityEditor.ScriptExecutionOrderInspector.OnInspectorGUI () (at <1e441e8684a14fe4b8f8a926d91afc3a>:0) UnityEditor.AssetSettingsProvider.OnGUI (System.String searchContext) (at <1e441e8684a14fe4b8f8a926d91afc3a>:0) UnityEditor.SettingsWindow.DrawControls () (at <1e441e8684a14fe4b8f8a926d91afc3a>:0) UnityEditor.SettingsWindow.DrawSettingsPanel () (at <1e441e8684a14fe4b8f8a926d91afc3a>: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

Demigiant commented 3 years ago

I finally understood! Sorry it took me so long but I was making all kinds of crazy tests to determine what was causing the issue, and I finally realized.

The problem is 100% a Unity bug (going to make a sample project and write them about it) with DLLs. Unity absolutely allows to have a DLL that contains multiple MonoBehaviours or ScriptableObjects, but Unity's new ScriptExecutionOrder panel's popup has a bug where it uses the wrong dictionary cache in those cases. So the solution for now is to use drag and drop (there's nothing I can do on my side), and since this is quite a major bug I hope it will be fixed soon.

Demigiant commented 3 years ago

Sent a repo project to Unity along with this pic:

! README

Demigiant commented 3 years ago

Unity apparently knew about this already and fixed it in v 2021

jquentin commented 3 years ago

So is there a workaround, without updating to 2021?

Demigiant commented 3 years ago

@jquentin Yes, just drag and drop the script in the panel instead of using the + button