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
1
Question by MEDIALLIANCE_2 · Jan 21, 2017 at 06:46 AM · assetbundleassetbundlesmanifest

Get Hash from streamed scene asset bundle

Hello,

I'm currently trying to export and import assetBundle that contains a scene. I'm trying to access the hash in order to use WWW.LoadFromCacheOrDownload (String url, Hash128 hash) as checking if I should download a new bundle on the server or not.

Unfortunately, I can't get the assetBundleManifest from the assetBundle, which should give me the hash I need to compare the versions of the bundles in cache or online.

 //Download assetBundle via WWW
 WWW wwwManifest = new WWW (path);
 yield return wwwManifest;
 
 //get the manifest
 AssetBundle manifestBundle = wwwManifest.assetBundle;
 AssetBundleManifest manifest = manifestBundle.LoadAsset ("AssetBundleManifest") as AssetBundleManifest; //Fails because my bundle is a scene
 //Get The hash
 Hash128 hash = manifest.GetAssetBundleHash (bundleName);
 //Get the last bundle from hash
 WWW www = WWW.LoadFromCacheOrDownload (path, hash))


Apparently, I can't use LoadAsset () on a streamed scene assetBundle. Maybe I'm doing something wrong. I just want to load the newest scene bundle, if I use WWW.LoadFromCacheOrDownload (String url, int version), it always get the one from the cache.

Can someone help me out with this? Or at least explains me how it exactly works, because I'm a bit lost and I don't understand everything about assetbundles.

Thank you, Antoine.

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 MEDIALLIANCE_2 · Jan 23, 2017 at 03:11 PM

Still didn't figure out about Hash but I get it to work I think with versions.

As I understand version is stored with the bundle in the cache when downloaded with: WWW.LoadFromCacheOrDownload (String url, int version)

The version you give has to be incremental on each new version of the assetbundle on server during download (and not during export...). My workaround:

Export the dateTime in a text file when exporting the assetbundle. This will be the way to check if the assetBundle is more recent than the one in cache. On each Download, you'll store the dateTime localy (playerPrefs for instance), so you'll have the dateTime on server and on cache for comparison. Then you'll have to store the version integer as well, which will be incremented at each new download. This version number will be set as parameter into the WWW.LoadFromCacheOrDownload (String url, int version) function. This way, the version number is incremental and has the lastest number of the assetBundle version.

I'm still looking for answers about the Hash for sceneAssetBundle which seems to be a better way to do so.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Loading.IDRemapping AssetBundles 1 Answer

AssetBundleManager - what asset bundle URL to specify for iOS (Xcode simulator, Testflight, Appstore)? 0 Answers

Assetbundle problem: it was not built with the right version 0 Answers

AssetBundles don't load to scene on Android device. 3 Answers

Image textures in assetbundles 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