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 wijesijp · Sep 06, 2016 at 12:02 PM · assetbundle

loading assetbundle offline

I am checking assetbundle example here; https://unity3d.com/learn/tutorials/topics/scripting/assetbundles-and-assetbundle-manager

In the assets bundle manager it is listed;

 if (isLoadingAssetBundleManifest)
                 download = new WWW(url);
             else
                 download = WWW.LoadFromCacheOrDownload(url, m_AssetBundleManifest.GetAssetBundleHash(assetBundleName), 0); 


If we are downloading the assets for the first time downloading the manifest from the web make sense.

Suppose we download the content for the first time, then we don't have to go online to get the content. If the player is offline how to we download the manifest?

How to handle a situation like this?

Player download the content by going online. Then he turn off internet connection. If we start the game the manifest does not get loaded?

Suppose I am aware when the player suppose to go online is there a way to say get the bundleassets offline or from where it get saved ?

Comment
Add comment · Show 5
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 Brian-FJ · Sep 06, 2016 at 01:47 PM 0
Share

Best I can think of is that after you load the asset bundles you save them locally (Depending on your platform there are suggested folders to save data to. Or you may be able to use the application folder.).

But every time you go to load your asset bundle data you check if the files exist at the local directory first and then call WWW.Load from either the local or the web url as appropriate. For the url in WWW.Load you can use a local address and it will still work (ie. WWW.Load("C:\$$anonymous$$yGame\CachedData\assetbundle.asset"); on windows.).

This way you are not relying on Unity's cache too heavily and after the first launch the data will exist locally so the user doesn't need to be online. If this sounds good to you let me know and I'll mark this as an answer :)

avatar image wijesijp Brian-FJ · Sep 06, 2016 at 02:20 PM 0
Share

I didn't realized it is possible to save objects like that.

Suppose I download a prefab from the assets bundle.

Is it possible to save it to a location on a Android device?

avatar image Brian-FJ wijesijp · Sep 06, 2016 at 02:29 PM 0
Share

Yes it is. The main thing you need to do is make sure you write to an accessible location. I think Application.persistentDataPath will give you an appropriate path.

Look at this question, http://answers.unity3d.com/questions/539339/saving-data-in-to-files-android.html. This person is saving a .txt file but if you use File.WriteAllBytes you should be able to save the bytes field of your asset bundle.

Does that all make sense?

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Brian-FJ · Sep 06, 2016 at 02:29 PM

Best I can think of is that after you load the asset bundles you save them locally (Depending on your platform there are suggested folders to save data to. Or you may be able to use the application folder.).

But every time you go to load your asset bundle data you check if the files exist at the local directory first and then call WWW.Load from either the local or the web url as appropriate. For the url in WWW.Load you can use a local address and it will still work (ie. WWW.Load("C:\MyGame\CachedData\assetbundle.asset"); on windows.).

This way you are not relying on Unity's cache too heavily and after the first launch the data will exist locally so the user doesn't need to be online.

Comment
Add comment · 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

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

56 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 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

How to import the object from server to unity 2 Answers

Whats the difference between an Object and A GameObject? 2 Answers

How to load Assets as GameObjects? 1 Answer

Object parent Asset Bundle 1 Answer

Streaming scenes in assetbundles 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