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.
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.
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:
public class BoneInformationContainer : ScriptableObject
{
public BoneInformation[] boneInformation;
}
public class BoneInformation : ScriptableObject
{
public string boneName;
public Vector3 localPosition;
}
Bundling a BoneInformationContainer object would cause the error, but bundling a BoneInformation object wouldn’t.
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.
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.
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.
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.
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.
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.