Is it possible to reduce webgl builds to 300kb?

Hi there,

  1. right now the empty project is about 2.3 MB, but hypothetically, if you want to develop a 2D game, can you strip most of the unity engine to generate below 1MB project ?

  2. why doesn’t unity strip the engine on the class level ( not the module leve), right now it includes the full 5 MB physics module even if you use a simple Physics.Raycast ?

Thanks.

  1. No, sadly that is the smallest it gets at the moment.

  2. That is not a trivial thing to do. We’d really like to get there in the future though but for now this is where we’re at.

Which version of Unity are you using? My empty project builds up to 4MB

@ywj7931 I’m using unity 2017.1 , make sure to use brotli compression instead of gzip (it slower to compress, so use it only for final builds or to test build size )

@Schubkraft Thanks

But will that cause compatibility issue, some browser doesn’t support brotli?

In that case Unity will just decompress the payload using javascript instead of doing the decompression at the “browser level” (the end result will be a longer load time for the end user). Regardless, you can use gzip compression (supported everywhere) which will also bring it below 4MB. Currently our binary (contains only code, almost no art assets) is 3.5MB with gzip compression so it’s definitely feasible.