Search Unity

Error: Inconsistent asset when sorting preload assets: '' fileID: 0

Discussion in 'Editor & General Support' started by Christian, Nov 1, 2010.

  1. Christian

    Christian

    Joined:
    Dec 2, 2008
    Posts:
    24
    When I build a bundle with

    Code (csharp):
    1. BuildPipeline.BuildAssetBundle(targetPrefab, obj, WbStructure3DScreenshot.getOutputFolder() + exportObject.name + ".bundle", BuildAssetBundleOptions.CollectDependencies);
    I get this error:

    Code (csharp):
    1. Inconsistent asset when sorting preload assets: '' fileID: 0
    2. UnityEditor.BuildPipeline:BuildAssetBundleInternal(Object, Object[], String[], String, BuildAssetBundleOptions)
    3. UnityEditor.BuildPipeline:BuildAssetBundleInternal(Object, Object[], String[], String, BuildAssetBundleOptions)
    4. UnityEditor.BuildPipeline:BuildAssetBundle(Object, Object[], String, BuildAssetBundleOptions)
    The Prefab I want to export has some child GameObjects with attached MeshFilters that contains a self defined mesh which is created at runtime. Like the most Editor errors this one is not documented somewhere.

    Any ideas?

    Thanks in advance.
     
  2. arioch82

    arioch82

    Joined:
    Dec 3, 2009
    Posts:
    253
    same problem here.
    trying to build a bundle with a prefab (a PackedSprite from SpriteManager2).

    did you manage to solve it?
     
    Last edited: Nov 24, 2010
  3. phiT

    phiT

    Joined:
    May 28, 2009
    Posts:
    18
    Mabe a problem dedicated to 3.1f4 ?
     
  4. arioch82

    arioch82

    Joined:
    Dec 3, 2009
    Posts:
    253
    i've noticed that also with all the errors the bundle works without problems but it would be nice to understand what's causing it
     
  5. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    This issue has been reported before but existing cases seem to have been fixed. Please can you start a new bug report for this (menu: Help > Report A Bug). Even if it is harmless it's still better if we can reproduce and fix it.
     
  6. elveatles

    elveatles

    Joined:
    May 2, 2009
    Posts:
    147
    Has this been taken care of? I'm getting this error too. Seems to happen if I make an array of ScriptableObjects inside a different ScriptableObject and try to bundle the root. For example:

    Code (csharp):
    1.  
    2. public class BoneInformationContainer : ScriptableObject
    3. {
    4.     public BoneInformation[] boneInformation;
    5. }
    6.  
    7. public class BoneInformation : ScriptableObject
    8. {
    9.     public string boneName;
    10.     public Vector3 localPosition;
    11. }
    12.  
    Bundling a BoneInformationContainer object would cause the error, but bundling a BoneInformation object wouldn't.
     
  7. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    220
    Getting this error in 3.4.2f2
    It was reported a year ago, is it not fixed yet?
     
  8. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,125
    has this been fixed yet???
     
  9. stridervan

    stridervan

    Joined:
    Nov 11, 2011
    Posts:
    141
    The error is due to a missing link. I had the same problem but turned out it was due to a missing mesh from the GameObject I generated in the editor. I created the GO and assigned it a mesh which I also created during runtime(but didn't save the mesh). You have to save the mesh as an asset before building the bundle. It applies to any dependencies which are not saved assets.
     
  10. Lermy-KefSensei

    Lermy-KefSensei

    Joined:
    Apr 21, 2015
    Posts:
    7
    This error is still happening in version 5.1.1p1.

    When referencing by mistake an asset from a different bundle variant, you will receive this error.

    You can reproduce it as follows:

    -Create a canvas and add two image to it.
    -Create a prefab (with both images inside) and assign it to a bundle (let's call it prefab.bundle)
    -Add a sprite texture reference to one image, the sprite texture will go in another bundle that will have variants, let's call it sprite_bundle.hd.
    -Add another sprite texture to the other image, but this time assign this texture into another variant, like sprite_bundle.sd.
    -Save the prefab.
    -Build the bundles! and you will see the error.

    You can check in the prefab.bundle.manifest that this bundle depends on both sprite_bundle.sd and sprite_bundle.hd.

    Somehow you need to avoid referencing two variants from the same prefab, this is not automatically validated by Unity.
     
    Last edited: Aug 8, 2016
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, I'm attempting to upgrade to 5.2 and getting these errors when building bundles. This seems like another example of the variant system being not well thought out. We're using variants to provide different sized textures to different classes of device (as I expect most of you are). This means you end up with 3-4 copies of each texture in your tree, which leads to errors keeping them all in sync, as well as massive caching and build times - all to effectively not download the highest mip level on a device which will never use it.

    My loading system strips the asset bundle down to it's base name then re-builds the path based on the requested variant - so unless this causes my pointers to be broken it shouldn't be an actual issue for me. But if this is going to throw an error, then unity should make it not possible, and in fact likely, to reference assets this way. For instance, if I open up a texture window to select a texture, it should only show me one option per variant and reference it in a variant-less way. Asking the users to carefully make sure every pointer only points to the same variant level seems pretty silly and massively error prone, especially since everything will work just fine until it hits the build machine.
     
  12. lermy3d

    lermy3d

    Joined:
    Mar 16, 2014
    Posts:
    101
    I totally agree with you jbooth, if someone has not posted a bug report yet I am going to make one, otherwise please share the bug report link to follow up this issue.

    Best regards to all,
    Lermy
     
  13. arielsan

    arielsan

    Joined:
    Dec 3, 2013
    Posts:
    47
    I had the same error, the reason was I was referencing assets from the same bundle but different variations in a prefab, changed to reference only one variation fixed it.

    To explain my case better:

    BundleA
    hd
    image1
    image2
    sd
    image1
    image2

    So, in my prefab I had two images, the first one pointing to hd.image1 and the second pointing to sd.image2, that was causing the error.

    Hope it helps to find the problem.
     
    MerlinTwi and Lermy-KefSensei like this.
  14. Grish_tad

    Grish_tad

    Joined:
    Oct 11, 2013
    Posts:
    2
    This error is still happening in version 5.6.2f1.
     

    Attached Files:

  15. lumanskiy

    lumanskiy

    Joined:
    Oct 23, 2015
    Posts:
    8
    It's been 8 years since this bug was reported, can we please, please get it fixed? Or at least, add more information about the cause into the error?

    I just spent an hour randomly removing parts of my project using binary search; just to figure out that nothing was wrong on my side - just bugs in Unity serialization caused Unity to incorrectly calculate dependencies for one of the asset bundles.

    In my case, my prefab referenced a sprite that was in the sprite atlas variant and somehow Unity decided that my prefabs bundle depends on my "textures.sd" bundle variant. After I found the file that caused it (no idea why) I simply re-created it, forcing GUID to update and it fixed the problem.
     
    HANKASHIN likes this.