Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Assertion failed on expression: 'ins.second || ins.first->second

Discussion in 'Editor & General Support' started by unicesumar, Aug 20, 2020.

  1. unicesumar

    unicesumar

    Joined:
    Jul 11, 2019
    Posts:
    4
    When I generate an Assetbundle for iOS this error appears.

    Assertion failed on expression: 'ins.second || ins.first->second == targetHash || (ins.first->second == CircularDependencyHash() && !targetHash.IsValid()) || GetPathFromAssetGuidV2(key.GetGUID()).ends_with(".cs")' UnityEditor.BuildPipeline:BuildAssetBundles(String, AssetBundleBuild[], BuildAssetBundleOptions, BuildTarget)

    Alguém sabe o que pode ser?

    Usando Uniey 2020.1.2f1
     
    goldcloud144 and MilenaRocha like this.
  2. gaglabs

    gaglabs

    Joined:
    Oct 17, 2019
    Posts:
    185
    Same issue and no fix
     
  3. lumeneo

    lumeneo

    Joined:
    Mar 3, 2014
    Posts:
    60
    I had the same problem. In the Editor Log, for me, it showed issues trying to build in the fonts used by a vendor-supplied Editor-based tool I wasn't using. I deleted the .TTF files, and it worked.
     
  4. NimestTech

    NimestTech

    Joined:
    Aug 14, 2019
    Posts:
    4
    Probably, you have already found the problem, but for the new people who encounter this issue.
    There are probably two files with the same name but in different folders in the same Asset Bundle (even if they are in different "subdivisions".

    So, find the files and rename them.
     
    MiguelAppStudio likes this.
  5. NimestTech

    NimestTech

    Joined:
    Aug 14, 2019
    Posts:
    4
    Another solution:

    Are you trying to build iOS bundles in Android Platform?

    This was the reason for these errors for me.
     
    SPIKE_SPEIGEL likes this.
  6. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    1,051
    I also had this error due to a font. Specifically, it was due to the «References to other fonts in project» being null/missing. After changing something in the inspector and changing it back so that I could apply, the references came back and the error disappeared.
     
  7. huulong

    huulong

    Joined:
    Jul 1, 2013
    Posts:
    223
    In my case, some fonts referred to variants as fallback, but it was not editable (fallbacks are auto-generated and grayed out). I did a modification, Applied, reverted the change and re-Applied, but it only added more fallbacks (when font variants are imported together, the first to be imported don't know the others, while the last one refers to all the previous onces, so this operation added links between all of them more uniformly).

    The solution seemed to be:
    a. remove the variant font assets entirely from the project (but I may need them later)
    b. manually edit the JSON to remove fallback references (possible, but if somebody touches the asset and Applies they will reappear)
    c. force the inclusion of all Font variant assets in the project (you can use Resources, preloaded assets and maybe bundles)

    I chose c. and moved all the font assets to Resources, as there were not too many so it shouldn't be too heavy.
    It fixed the assertions!

    (the build itself was working I think, just the assertions appeared near the end during asset importing phase)
     
  8. w34edrtfg

    w34edrtfg

    Joined:
    Nov 23, 2014
    Posts:
    72
    As usual Unity error message is useless.
    The best thing you can do is check editor's log. You can find it's location here:
    https://docs.unity3d.com/Manual/LogFiles.html
    And since Unity also randomly breaks documentation pages, i'm leaving a webarchive fallback:
    https://web.archive.org/web/20200430102912/https://docs.unity3d.com/Manual/LogFiles.html

    If you search for the useless error message inside the log, you will find what it was doing before exploding. Like:
    Code (CSharp):
    1. Start importing Assets/Photon/PhotonUnityNetworking/Demos/Shared Assets/Skin/Jura-Medium.ttf using Guid(e00995507c2406448b4c8429136104dd) Importer(-1,00000000000000000000000000000000) Assertion failed on expression: 'ins.second || ins.first->second == targetHash || (ins.first->second == CircularDependencyHash() && !targetHash.IsValid()) || GetPathFromAssetGuidV2(key.GetGUID()).ends_with(".cs")'
    2. UnityEditor.BuildPipeline:BuildAssetBundlesInternal(String, BuildAssetBundleOptions, BuildTargetGroup, BuildTarget)
    3. UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTargetGroup, BuildTarget)
    4. UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTarget)
    5. Peque.BundleBuilder:buildAllBundlesDesktop() (at Assets\Editor\BundleBuilder.cs:8)
    6.  
    In my case Unity was trying to import a font that i'm not using, so i deleted the entire "Demos" folder of Photon.
     
    Lorrak, MilenaRocha and Peekaboo2018 like this.