Asset Bundle Tutorial

Hi there,recently I am working on a project which includes many assets to be loaded from the server at runtime,but the lag is quit unacceptable since the assets amount is too much.I have noticed there is a asset bundle feature in code but without much documents,is there any guide to use this feature?or is there any better solution?


Well,I found this project at the playcanvas offical account https://playcanvas.com/project/687576/overview/asset-bundle-small-files-test

I have forked the project and tested for a while,that’s totally what I am looking for :smile: but I don’t know how to create the bundle asset like this:


is this feature still not public?
Besides,is there any way to create the bundle asset in code?how can I add and remove asset in code?

Asset bundles are still an unfinished feature and that project should not be public (that’s my bad).

Is the problem the size of the download or the latency of downloading each asset? Where are you based in world?

As the server for PlayCanvas is in the EU, I would recommend self hosting the build for your users (and distribute on a CDN) to reduce the latency for your users.

1 Like

Oh,I see :smiley: I think the problem is the latency,there is just too many assets to be loaded.I live in China and the file is already self hosted with CDN distributed.
In fact,I am facing another problem. In order to keep the app stable,I use asset.unload() to free the VRAM everytime the asset is hidden. By calling the asset.load() the asset should load from the browser cache without any additional network transmission,it work fine on pc and chrome mobile but on some browser,in our case Weixin browser on mobile,the asset will download again just like the browser cache is disabled.
I have no idea what could cause this,and after a long journey searching the forum and github I found the asset bundle above.I have tested that feature and found the asset could reload from the bundle immediately without any network download even when the browser cache is disable as long as the bundle asset itself is not unloaded.That’s totally what I’m looking for! Can you give me some advice?
BTW the asset bundle feature is awsome,I hope we can see it soon!

Yes assets bundles will be so useful!

@FBplus for your caching issue though that seems an issue with the browser. Sometimes there is a hard limit on the total occupied size of a local cache the browser will allow per domain name.

Not sure if that’s your issue here, but definitely take a look at how the browser handles caching since it seems to be an issue on the browser side.

1 Like

Thanks Leonidas :smile:
I’ll have a look at the browser cache.

1 Like

Im not sure this is the same thing but there is a feature request on showing images as html images and not having to make download them/convert into textures before displaying.

You can do this by getting the URL from the asset and using it as the HTML image src

https://developer.playcanvas.com/en/api/pc.Asset.html#getFileUrl

yes but that still means you have to download the image and convert it to texture before you can use it correct?