WebGL Optimization

Hi,

Our game loads on WebGL fines, but it still take alot of data.

I had question on how to optimize a game for WebGL.

First :
When you build a game, are all the content from the Assets folder included inside of the game ?
If so, are unused content also included ?

Second :
How do you reduce drastically the content of a game scene ? What make a small scene with alot of mesh high in size ? How can I reduce this ?

For example. the texture of my game uses 1.5GB of Ram. I suspect it is because of photoshop files. I was wondering if there was a possible technique to reduce drastically this behaviour.

Thanks you.

Probably textures is your biggest worry. Standard shader expects 3-6 textures so everything multiplies.

Unity automagically combines textures onto atlases, and reduces texture sizes on WebGL, but there are ways to take control of this process, so you can shrink textures even further (override settings under quality, or the textures’ import settings). There are ways to compress textures even more than Unity does, but then you need to override how Unity packs it’s textures (essentially you switch over to an included folder of highly compressed png).

Unity searches your assets folder to decide what it can leave out of your game build. It works well, but it is an automated process, and it’s possible you have used some assets that make reference to other assets you haven’t used, and Unity may consider this to mean the other assets should be included because they can be referenced….

Read the docs about what happens when you build, there are probably dozens of things you might be able to leave out, or reduce.

1 Like