Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Riyria · Jan 25, 2015 at 03:47 PM · c#androidassetbundlexml

AssetBundles are not working outside editor on PC or Android.

So, im just playing around with AssetBundles to store sound packs outside of the original .apk to reduce file size. I seem to have the system worked out, as it runs exactly how I would like while running in editor, unfortunately attempting the same processes outside of editor is failing and I'm not sure why...

Here is the snippet of code for the actual downloading of the file. What I'm trying to do is download the AssetBundle, then extract a base .xml of the files inside and save that elsewhere.

     //work in editor
     public IEnumerator DownloadBundle()
     {
         if(!Directory.Exists(Application.persistentDataPath + "/Bundles"))
             Directory.CreateDirectory(Application.persistentDataPath + "/Bundles");
     
         WWW www = new WWW(url);
         yield return www;
 
         //save to assetbundle to disk
         SaveBytesAsFile(downloadPath, www.bytes);
     
         //load in asset from disk
         currentBundle = AssetBundle.CreateFromFile(Application.persistentDataPath + "/Bundles/AssetBundle.unity3d");
         yield return currentBundle;
     
         if(!Directory.Exists(Application.persistentDataPath + "/BundleData"))
             Directory.CreateDirectory(Application.persistentDataPath + "/BundleData");
     
         TextAsset a = currentBundle.Load("Bytes", typeof(Object)) as TextAsset;
 
         File.WriteAllBytes(Application.persistentDataPath + "/BundleData/Bytes.xml", a.bytes);
     }


Yeah, ignore the terrible formatting...

Any help on this would be greatly appreciated :)

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Paulius-Liekis · Jan 25, 2015 at 10:56 PM

What's the platform of your asset bundles? My guess is PC (i.e. Standalone). AssetBundles are platform specific and you must build separate AssetBundles for each platform.

Comment
Add comment · Show 4 · Share
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
avatar image Riyria · Jan 26, 2015 at 05:06 AM 0
Share

They are being saved as Android as the target platform, and as an uncompressed asset bundle.

avatar image Paulius-Liekis · Jan 26, 2015 at 10:30 AM 0
Share

What kind of indication is there that it doesn't work? What do you see in the log?

avatar image Riyria · Jan 26, 2015 at 01:38 PM 0
Share

Uh.. What Log?

As for an indication, further on in the process it fails to load any of the data from the .xml like it had in previous iterations of the project.

Browsing the data path I'm using it does seem to download and extract the .xml from the assetbundle, but fails to read it. I mean this could be an issue in my read code, but I cant for the life of me figure out why it would be, as I haven't changed anything in that.

avatar image Paulius-Liekis · Jan 26, 2015 at 01:42 PM 0
Share

On PC (Standalone build): there should be a log after a run somewhere is the folder of your build.

On Android: use "abd log" command in a Ter$$anonymous$$al to see output from Debug.Log.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

Loading Xml file issues 0 Answers

In an Addressable system, how to manage multiple profiles with different Remote Load Path without making a new build? 0 Answers

Save and Load data from Local XML file won't work 1 Answer

Baffled by Android storage system... 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