Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to split data files into smaller chunks in Unity WebGL builds?

I am limited to the size of web applications I can build by the "Build\application.data" file. I.e if its over a certain size I cannot upload it certain hosts, github, etc. Ideally I would like to split the application into multiple data files under a certain size, while the application is still executable.

How would this be possible? Is this something I can do from Unity build configuration? Can I do it after the build is done? Can I split the file into chunks by archiving it with zero compression, and somehow still execute it from the browser? There is a file called Build.Loader.js, is it something that can be edited for this purpose?

This is for the purposes of using the application after it has been uploaded, not sharing it, I do not want to compress it into separate archives, or use gitlfs, I've tested this and the application does not work from the browser with github and gitlfs.

enter image description here

Thanks

like image 623
Mich Avatar asked Nov 28 '25 17:11

Mich


1 Answers

Unity has 2 technologies for split data file:

  1. Asset bundle

An AssetBundle is an archive file that contains platform-specific non-code Assets (such as Models, Textures, Prefabs, Audio clips, and even entire Scenes) that Unity can load at run time

  1. Addressbles

The Addressable Asset System allows the developer to ask for an asset via its address. Once an asset (e.g. a prefab) is marked "addressable", it generates an address which can be called from anywhere. Wherever the asset resides (local or remote), the system will locate it and its dependencies, then return it.

Both technologies create separate files that you can host on a server and download as needed. Addressable is a newer technology that Unity team recommends.

Probably the total size of the bundle will grow, but user will be able to download only the necessary assets and the amount of data for the user may decrease

If you do not use Unity solutions, you can divide data file into parts. But on the client side (javascript) you will need to download all the parts, connect them and pass to Unity loader. You probably won't be able to use the browser's built-in gzip or brotli (not sure). It seems to be quite difficult.

like image 166
stazik Avatar answered Dec 01 '25 21:12

stazik