Search Unity

Conflict with Beautify & Postprocessor

Discussion in 'Addressables' started by novaVision, Jul 23, 2018.

  1. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    518
    Implementing addressables to my existing project I get an editor error about some resources from Beatify and Postprocessor package.
    Here is some related to Beautify

    Code (CSharp):
    1. ArgumentException: An item with the same key has already been added. Key: Particles/ParticleBlendZBuffer
    2. System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <f826c2584fc94ec19a48a6576640bdc5>:0)
    Checked the project - there is only 1 ParticleBlendZBuffer.mat and ParticleBlendZBuffer.shader in a project.
    Removing it (just for tests) cause errors related to another resources and so on. Same with PostProcessor, but here reimporting the package helped.

    What could the issue? These errors appears on "Preview" or building the app.
     
    Last edited: Jul 23, 2018
  2. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    518
    Reimporting didn't help as well.. Have no clue how to fix it.

    Just tested on clean project with Beautify + Addressables, and got this error or preview/build


    Code (CSharp):
    1. ArgumentException: An element with the same key already exists in the dictionary.
    2.   at System.Collections.Generic.Dictionary`2[System.Object,UnityEngine.AddressableAssets.ContentCatalogData+DataEntry].Add (System.Object key, UnityEngine.AddressableAssets.DataEntry value) [0x0007e] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404
    3.   at UnityEditor.AddressableAssets.PlayerDataAssetGroupProcessor.ProcessGroup (UnityEditor.AddressableAssets.AddressableAssetSettings settings, UnityEditor.AddressableAssets.AddressableAssetGroup assetGroup, System.Collections.Generic.List`1 bundleInputDefs, System.Collections.Generic.Dictionary`2 locationData) [0x00102] in /Users/Romaha/Library/Unity/cache/packages/packages.unity.com/com.unity.addressables@0.1.2-preview/Editor/Build/GroupProcessors/PlayerDataAssetGroupProcessor.cs:35
    4.   at UnityEditor.AddressableAssets.BuildScript.PreviewDependencyInfo (UnityEditor.Build.Pipeline.BuildDependencyData& depData, UnityEditor.Build.Pipeline.BundleWriteData& bundleWriteData) [0x00077] in /Users/Romaha/Library/Unity/cache/packages/packages.unity.com/com.unity.addressables@0.1.2-preview/Editor/Build/BuildScript.cs:348
    5.   at UnityEditor.AddressableAssets.AssetSettingsPreview.ReloadPreview () [0x00018] in /Users/Romaha/Library/Unity/cache/packages/packages.unity.com/com.unity.addressables@0.1.2-preview/Editor/GUI/AssetSettingsPreview.cs:91
    6.   at UnityEditor.AddressableAssets.AssetSettingsPreview.ReloadIfEmpty () [0x0001d] in /Users/Romaha/Library/Unity/cache/packages/packages.unity.com/com.unity.addressables@0.1.2-preview/Editor/GUI/AssetSettingsPreview.cs:33
    7.   at UnityEditor.AddressableAssets.AddressableAssetsSettingsGroupEditor.TopToolbar (Rect toolbarPos) [0x000e3] in /Users/Romaha/Library/Unity/cache/packages/packages.unity.com/com.unity.addressables@0.1.2-preview/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:122
    8.   at UnityEditor.AddressableAssets.AddressableAssetsSettingsGroupEditor.OnGUI (Rect pos) [0x001f8] in /Users/Romaha/Library/Unity/cache/packages/packages.unity.com/com.unity.addressables@0.1.2-preview/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:330
    9.   at UnityEditor.AddressableAssets.AddressableAssetsWindow.OnGUI () [0x0024a] in /Users/Romaha/Library/Unity/cache/packages/packages.unity.com/com.unity.addressables@0.1.2-preview/Editor/GUI/AddressableAssetsWindow.cs:134
    10.   at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
    11.   at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d0] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222
    12. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    13.   at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000eb] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232
    14.   at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115
    15.   at UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) [0x00013] in /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:295
    16.   at UnityEditor.HostView.Invoke (System.String methodName) [0x00009] in /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:288
    17.   at UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition) [0x00100] in /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:255
    UPDATED

    Found a solution - renamed shaders, because there was same naming for some different types of files, but seems Addressables got some bug with it.
    Example:
    Beautify/Resources/Shaders/BeautifyBasic.shader and Beautify/Resources/Shaders/BeautifyBasic.cginc
    or
    Beautify/Resources/Particles/ParticleBlendZBuffer.shader and Beautify/Resources/Particles/ParticleBlendZBuffer.mat
     
    Last edited: Jul 24, 2018
  3. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Thanks for reaching out. Items in Resources are automatically given an address that matches what their Resources.Load lookup is. This is the filename without extension. Your example causes two items to have the same lookup key.
    We have a fix coming for this within the next release or two.
    Thanks,
    Bill
     
    Kronnect likes this.