Trouble building asset bundles

I’m using 5.3.5f1 with target of iOS.

I created a new asset bundle name (first in the project) and assigned my prefab to it in the drop down.

When I run the editor script to create the asset bundle from the docs, it shows the loading bar but then fails and throws the error:

Cannot mark assets and scenes in one AssetBundle. AssetBundle name is "underthesea".

UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTarget)
AssetBundles.BuildScript:BuildAssetBundles() (at Assets/AssetBundleManager/Editor/BuildScript.cs:24)
AssetBundles.AssetBundlesMenuItems:BuildAssetBundles() (at Assets/AssetBundleManager/Editor/AssetbundlesMenuItems.cs:27)

I don’t have any scenes in an asset bundle, I searched the project for scenes and went through each, none are assigned to an AB.

I haven’t built any asset bundles yet, it’s failed since my first attempt, I only have 1 asset bundle name and have assigned the prefab and the materials/textures it contains to the same assetbundle. Then try to build and it gives the error after a bunch of warnings (below).

And I’m getting hundreds of warnings prior to the error for things that aren’t even related to the model I’m trying to add to an asset bundle, it’s trying to add vuforia scripts and stuff when there isn’t a single script on the content I’m adding to AB’s:

Unrecognized assets cannot be included in AssetBundles: "Assets/Plugins/iOS/VuforiaRenderDelegate.h".
UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTarget)
AssetBundles.BuildScript:BuildAssetBundles() (at Assets/AssetBundleManager/Editor/BuildScript.cs:24)
AssetBundles.AssetBundlesMenuItems:BuildAssetBundles() (at Assets/AssetBundleManager/Editor/AssetbundlesMenuItems.cs:27)

Script assets cannot be included in AssetBundles: "Assets/Content/Scripts/Utility/PlayerPref.cs".
UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTarget)
AssetBundles.BuildScript:BuildAssetBundles() (at Assets/AssetBundleManager/Editor/BuildScript.cs:24)
AssetBundles.AssetBundlesMenuItems:BuildAssetBundles() (at Assets/AssetBundleManager/Editor/AssetbundlesMenuItems.cs:27)

edit::
I tried making a new asset bundle name “undertheseacontent”, went through and set everything to it instead of the “underthesea” name, and have triple verified that nothing is assigned to “underthesea” anymore but rather “undertheseacontent”, and I still get this error above!

I can filter by “underthesea” and it doesn’t find anything other than the object I’m using to set the flag to filter for, when I change the item to undertheseacontent the object disappears from the “b:underthesea” search filter, but I still can’t delete “underthesea”

edit::still can’t delete assetbundlename that doesn’t have anything assigned to it…and can’t successfully build any bundles because of the error above

I was able to reproduce this error (with Unity 5.3.5p1).

What i did was have 2 assets - a scene and another asset (material) marked with the same asset bundle name.

1 Like

Is that what you did to reproduce or fix?

edit again::

I exported out the prefab I’ve been trying to bundle, and opened it in a new project and can make the asset bundle without issue in a new project…

Edit:: I was able to manually delete the AB name with

[MenuItem ("Assets/Remove Undersea")]
    static void RemoveName ()
    {
        var names = AssetDatabase.GetAllAssetBundleNames();
        foreach (var name in names) {
            if (name == "underthesea") {
                AssetDatabase.RemoveAssetBundleName ("underthesea", true);
                Debug.Log ("Found and removed");
            }
            Debug.Log ("AssetBundle: " + name);
        }
    }

And then was able to build the asset bundle successfully, not sure what the hell was going on, definitely some bug letting things get in a hung state with the editor AB integration.

3 Likes

I met the same issue in Unity 2019.4.7f1 (“Cannot mark assets and scenes in one AssetBundle.”) and solved it with @lmbarns 's solution. Thanks a lot!

1 Like