• 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 mposwal · Jun 18, 2014 at 03:03 PM · iosassetbundle

Best way to load an asset bundle that is already locally stored on iOS

I have a single ~60mb asset bundle that is delivered to my app through an in-app purchase. The bundle is downloaded to the Application.persistentDataPath folder. Currently I am using www.LoadFromCacheOrDownload() and pointing it to the "file://..." url to load the bundle when I need to use it, but my question is, does this create a second copy in the cache that is needlessly taking up space on my users' devices? It doesn't make sense to me to have to download my bundle and cache it when it is already on my disk.

Thanks in advance for any assistance!

Comment
Add comment · Show 1
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 mposwal · Jun 18, 2014 at 05:37 PM 0
Share

Here's some more info:

Base app size: ~612 mb

App size after purchasing the extra content: ~672 mb --this makes sense, since the DLC is ~60 mb

App size after calling loadFromCacheOrDownload(): ~937 mb --this is a difference of 265 mb. The size of the assets in the bundle before compression is roughly 220 mb, so I am unsure of where the extra 45 mb comes from.

Any insight is much appreciated

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by dorpeleg · Jun 19, 2014 at 07:21 AM

Your DLC is 60mb when downloading. But after it downloaded, it's being saved uncompressed into the cache. That is why you are getting the extra 265mb.

I have done a bit of research on the topic of what is being saved when using www.LoadFromCacheOrDownload().

What I found was this: the app first downloads and saves the downloaded file in the cache and then in uncompresses the assets inside into the cache as well.

That might also explain the extra 45mb you are having.

I don't see a reason to download the bundle and then trying to load it from local.

Why not use www.LoadFromCacheOrDownload() from the start?

Comment
Add comment · Show 1 · 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 mposwal · Jun 19, 2014 at 02:55 PM 0
Share

Thanks for your insight dorpeleg.

Apple offers free hosting for IAP content on iOS 6 and later, which aside from being free comes with several other advantages.

Here's the reason I have to load it locally: the download occurs during the purchase transaction, but the downside is I don't receive a static URL that points to my bundle. Possibly its something I could get ahold of if I was coding the IAP natively but right now I am using the U3DXT Storekit plugin. If I did have the url I would just use LoadFromCacheOrDownload() from the start, as you suggest.

$$anonymous$$y app is already kinda large so an extra 45 mb is not too big a deal for me. The final app size will likely be smaller anyways once I do some optimizations.

Regardless, I appreciate your help!

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

22 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

Related Questions

Ios assetbundles are null 2 Answers

Unity Asset Bundle Project Update/SSL iOS Issue 1 Answer

Finding resources folder on iOs 3 Answers

Allow player delete Asset Bundle 1 Answer

Loading asset from an asset bundle crashes on ios. 1 Answer


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