Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by kpdisney · Mar 03, 2016 at 09:24 PM · assetbundleloadloadall

Getting the assets inside a bundle from unity 5 vs Unity 4

Hi folks,
I'm having an issue with reading assets from asset bundles in Unity 5, and wanted to see how others are handling this situation.

In Unity 4.x when viewing contents of asset bundles, I can get a list of all assets in the bundle (i.e. bundle.GetAllAssetNames() provides a list of asset paths inside the bundle)- I can also get this to work, when using unity 5 to view unity 4 bundles. However, in Unity 5, we only ever get the top asset (presumably the automatic 'MainAsset") . The assets themselves load fine, the issue is that, for example, when viewing a simple prefab of a game object it only lists the things we explicitly added to the bundle at bundle time. My use case- is that I simply want to put any found textures into a Texture2D list, shaders into a Shader list, etc. Again ALL of this works wonderfully in Unity 5 when viewing a Unity 4 bundle... but not when viewing a unity 5 bundle.

I have found, that if you right click the prefab, and 'select dependencies' and then use the default (from the Unity docs) assetbundle exporter script, you will get a bundle that DOES contain references to those assets (yet the bundle seems the same size so it is what I need to do via code). I have tried collecting dependencies from the selection to create this array of things to add the the bundle map... but they get added in a way that bloats the bundle.

I don't want to store a list of the assets inside the bundle, but clearly Unity 5's bundling no longer puts this info (by default) into the bundle. We do NOT use manifest files in our pipeline, so that's not the answer for me here.

At the bottom of the code sample below, are the main calls we make to make bundles (both unity 4 and unity 5)

 using UnityEngine;
 using System;
 using System.Collections;
 
 public class bundleIssue : MonoBehaviour
 {
     private WWW wwwLoader = null;
     private string BundlePath = "";
 
     void Start () {
         BundlePath = "path to the bundle";
         StartCoroutine(LoadAssetBundle());
     }
 
     IEnumerator LoadAssetBundle()
     {
         wwwLoader = new WWW(BundlePath);
         yield return wwwLoader;
 
         AssetBundle bundle = wwwLoader.assetBundle;
         string[] assets = bundle.GetAllAssetNames();
         int counter = 1;
         foreach (string asset in assets)
         {
             Debug.Log(counter + ") " + asset);
             counter ++;
         }
     }
 }  
 
 // How we make bundles in Unity 5.1.4:
 //BuildPipeline.BuildAssetBundles(directoryPath, buildMap, BuildAssetBundleOptions.ForceRebuildAssetBundle, target);
 //  
 
 // Our Unity 4.6 way:
 //BuildPipeline.BuildAssetBundle(prefab,new UnityEngine.Object[]{prefab},prefabPath,BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets,target);

Thanks for any help or ideas folks, KP

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

36 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Load Asset from cache clash at ios device ( 5.6.2p1 ) 0 Answers

Assetbundle sizes and redirection 0 Answers

How do I load an entire scene using Assetbundles? 1 Answer

AssetBundle.Load() to Texture2D 2 Answers

no extension method `LoadAssetAsync' of type `UnityEngine.AssetBundle 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges