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.

Trouble building asset bundles

Discussion in 'Editor & General Support' started by lmbarns, Jun 7, 2016.

  1. lmbarns


    Jul 14, 2011
    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:

    Code (CSharp):
    2. Cannot mark assets and scenes in one AssetBundle. AssetBundle name is "underthesea".
    4. UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTarget)
    5. AssetBundles.BuildScript:BuildAssetBundles() (at Assets/AssetBundleManager/Editor/BuildScript.cs:24)
    6. 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:
    Code (CSharp):
    1. Unrecognized assets cannot be included in AssetBundles: "Assets/Plugins/iOS/VuforiaRenderDelegate.h".
    2. UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTarget)
    3. AssetBundles.BuildScript:BuildAssetBundles() (at Assets/AssetBundleManager/Editor/BuildScript.cs:24)
    4. AssetBundles.AssetBundlesMenuItems:BuildAssetBundles() (at Assets/AssetBundleManager/Editor/AssetbundlesMenuItems.cs:27)
    6. Script assets cannot be included in AssetBundles: "Assets/Content/Scripts/Utility/PlayerPref.cs".
    7. UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTarget)
    8. AssetBundles.BuildScript:BuildAssetBundles() (at Assets/AssetBundleManager/Editor/BuildScript.cs:24)
    9. AssetBundles.AssetBundlesMenuItems:BuildAssetBundles() (at Assets/AssetBundleManager/Editor/AssetbundlesMenuItems.cs:27)
    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"
    Last edited: Jun 7, 2016
  2. lmbarns


    Jul 14, 2011
    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
    Last edited: Jun 7, 2016
  3. liortal


    Oct 17, 2012
    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.
    lmbarns likes this.
  4. lmbarns


    Jul 14, 2011
    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
    Code (CSharp):
    1. [MenuItem ("Assets/Remove Undersea")]
    2.     static void RemoveName ()
    3.     {
    4.         var names = AssetDatabase.GetAllAssetBundleNames();
    5.         foreach (var name in names) {
    6.             if (name == "underthesea") {
    7.                 AssetDatabase.RemoveAssetBundleName ("underthesea", true);
    8.                 Debug.Log ("Found and removed");
    9.             }
    10.             Debug.Log ("AssetBundle: " + name);
    11.         }
    12.     }
    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.
    Last edited: Jun 7, 2016
    Vedran_M, xeniaosense and reemhi like this.
  5. xeniaosense


    Aug 4, 2020
    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!
    Vedran_M likes this.