Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Trouble building asset bundles

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

  1. lmbarns

    lmbarns

    Joined:
    Jul 14, 2011
    Posts:
    1,483
    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):
    1.  
    2. Cannot mark assets and scenes in one AssetBundle. AssetBundle name is "underthesea".
    3.  
    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)
    7.  
    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)
    5.  
    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)
    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"
     
    Last edited: Jun 7, 2016
  2. lmbarns

    lmbarns

    Joined:
    Jul 14, 2011
    Posts:
    1,483
    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

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,476
    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

    lmbarns

    Joined:
    Jul 14, 2011
    Posts:
    1,483
    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
    xeniaosense and reemhi like this.
  5. xeniaosense

    xeniaosense

    Joined:
    Aug 4, 2020
    Posts:
    3
    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!
     
unityunity