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
2
Question by Tommynator · Nov 24, 2010 at 06:30 AM · wwwcacheloadfromcacheordownload

Loading Webplayer builds via WWW.LoadFromCacheOrDownload

I want to download a webplayer build through WWW.LoadFromCacheOrDownload() and load it using WWW.LoadUnityWeb():

WWW cachedDownload = WWW.LoadFromCacheOrDownload( "web_build.unity3d", version );
yield return cachedDownload;
if ( cachedDownload.error != null )
{
    Debug.LogError( cachedDownload.error );
    cachedDownload.Dispose();
    yield break;
}
else
{
    cachedDownload.LoadUnityWeb();
}

But as soon as the download is finished I'm getting the error "Cannot load cached AssetBundle." Downloading the same file using the usual WWW constructor works fine. I have a valid Unity Caching License and the caching in general is working, so that is not causing any problems. I guess that the web build is treated like an AssetBundle on deserialization and that is of course failing.

So my question is - were web builds never considered to be cachable or is this a bug?

Thanks, Thomas

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

3 Replies

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

Answer by Tommynator · Nov 26, 2010 at 03:53 AM

The easiest workaround I found so far is, to just create an AssetBundle from the complete scene by building it as streamed scene:

BuildPipeline.PushAssetDependencies();
//create asset bundle
BuildPipeline.BuildPlayer(new string[] { "MyScene.unity" }, "AssetBundle.unity3d", BuildTarget.WebPlayer, BuildOptions.BuildAdditionalStreamedScenes);
//create webplayer build
BuildPipeline.BuildPlayer(new string[] { "MyLoader.unity", "MyScene.unity" },"Player.unity3d", BuildTarget.WebPlayerStreamed, BuildOptions.ShowBuiltPlayer);
BuildPipeline.PopAssetDependencies();

And then load the bundle inside of my loader scene the following way:

WWW cachedDownload = WWW.LoadFromCacheOrDownload("MyScene.unity3d", 1);
yield return cachedDownload;
//load the asset bundles
cachedDownload.assetBundle.LoadAll();
//load game level
Application.LoadLevel(1);

That seems to work pretty fine and the unity caching is kicking in too :)

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
avatar image
0

Answer by Dreamora 1 · Nov 24, 2010 at 09:18 AM

do you own a cache addon license? otherwise you can't use the unity webplayer caching technology and have to create assetbundles that are small enough for the browser to keep it in his cache

Comment
Add comment · Show 2 · 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 duck ♦♦ · Nov 24, 2010 at 09:25 AM 0
Share

He said in the question: "I have a valid Unity Caching License". :-)

avatar image Tommynator · Nov 24, 2010 at 09:37 AM 0
Share

Yes, as I said I have a valid License and the caching is working perfectly for AssetBundles. The key difference is, that I want to use caching for web builds. I didn't find any information about if that is actually possible. I just assumed it would cache everything that is downloadable in a regular way too.

avatar image
0

Answer by mMrDude · Jul 27, 2011 at 03:03 PM

How much does a cache license cost? Heard it is quite expensive but haven't been able to source a price, yet.

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

1 Person is following this question.

avatar image

Related Questions

Web player cache 1 Answer

Quit application while downloading with www.loadfromcacheordownload makes application crash 0 Answers

LoadFromCacheOrDownload is sensibly slower than WWW, why? 1 Answer

LoadFromCacheOrDownload non asset bundles 1 Answer

Does WWW has cache? Any official member can give us a result? 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