d4rkc0d3r / d4rkAvatarOptimizer

d4rkpl4y3r's VRChat Avatar 3.0 optimizer
MIT License
400 stars 17 forks source link

"KeyNotFoundException" when Delete Unused Components is On #47

Closed Yan-K closed 1 year ago

Yan-K commented 1 year ago

I can successfully use Full preset with Delete Unused Components turned off, but when I try to create optimized copy with Delete Unused Components ticked, it gives following error:

KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
d4rkAvatarOptimizer+<>c__DisplayClass205_1.<CombineAndOptimizeMaterials>b__21 (d4rkAvatarOptimizer+MaterialSlot slot) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:3336)
System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].MoveNext () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Set`1[TElement].UnionWith (System.Collections.Generic.IEnumerable`1[T] other) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable+DistinctIterator`1[TSource].FillSet () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable+DistinctIterator`1[TSource].ToList () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
d4rkAvatarOptimizer+<>c__DisplayClass205_1.<CombineAndOptimizeMaterials>b__4 (System.Collections.Generic.List`1[T] list) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:3336)
System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].ToList () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
d4rkAvatarOptimizer.CombineAndOptimizeMaterials () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:3336)
d4rkAvatarOptimizer.Optimize () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:154)
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizerEditor.cs:130)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <a259d3c004024353a2c217da97495055>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
d4rkc0d3r commented 1 year ago

I made it log a warning instead of crashing if this happens again. It might cause other issues though so keep an eye out for it.

Yan-K commented 1 year ago

Thank you so much! newer version works perfectly.