How to optimize your Unity game for Mobile, PC & WebGL: from 230MB to 3.7MB

preview_player
Показать описание
How to optimize Unity Mobile, PC & WebGL to reduce build size? Is your Unity build as small as possible? Information about optimizing a Unity Mobile, PC & WebGL build is very limited, but not anymore! In this tutorial we take a look at optimizing the textures of a Unity build with incredible results. I started at 230MB and brought it back all the way to just 3.7MB.

0:00 Intro
1:34 Finding Bottlenecks
2:46 Import Settings
7:31 Sprite Atlas
12:20 Repeatable Sprites
14:17 Outro

Support GameDevLuuk on Patreon!

BE PART OF THE COMMUNITY
-------------------------------------
Рекомендации по теме
Комментарии
Автор

Hey, I have some comments:
- You mention using POT textures is the most important part, but that's only true in some setups. At some point you had a warning saying that it couldn't compress the texture because it's width or height we're not a multiple of 4, so that's also an option too in some cases.
- Related to that and atlases, you don't need to worry about POT or multiples of 4 if you put sprites in an atlas. You kind of mentioned that, but then at the end you added a new sprite and made it POT while you could have made it of any size and put it inside an atlas.

Those 2 points are really important for artists, it's better to let Unity do the annoying work and remove that step from the artists' task. Also, this is REALLY usefull whey using sprites for UI, since you usually want sprites to stretch and stuff like that. Having extra invisible space makes it harder to place them consistently.

- When you created the atlas you mentioned that since you had some big images, they took all the space and some other images didn't fit in. You don't need to remove them, when you create an atlas it'll automatically create multiple textures to fit everything. You can see these other textures if you press the "#1" button in the preview header. I'd suggest you keep everything in the atlas to save more space.

- The 40MB atlas can be imported as individual images and let Unity put them in an atlas. May seem redundant, but if you compare your handmade atlas with Unity's you'll see they pack sprites a lot tighter, you might save some more space if Unity's packaging removes enough empty space to use a smaller POT size

But anyway, this was a really good video, lots of people don't know about this stuff and it's nice to see real world examples of the benefits of using good import settings.

DiegoSLTS
Автор

alright boys we gotta gas his channel up. This man is wayyyy too underrated. best game dev out there by far.

CROXoDyLE
Автор

You can actually create something like two pixel image to use as gradient to save even more memory. Top pixel would be lighter green, bottom one darker green in this case. If you apply it to an image component stretched across your screen Unity will blend these colors (filtering mode needs to be set to bilinear or trilinear).

q
Автор

I just got my project down from 107mb to 14.9mb! This video is great, thank you!

xdeathknightx
Автор

Really impressive!
I just reduced my build from 46mb to 12mb and still have more assets to change.

yurinativo
Автор

This is gold. Great video, saved my team in the final build stages. Thank you

tpaslou
Автор

@12:20 this is a nice tip! You can go even more crazy and have the sprite only consist of 2 pixels (1 wide, 2 high). Unity will then create a gradient for you. I think that leaves you with a file size of 8 Byte ;)

vivienlynn
Автор

Your lesson about unity optimization is the most usefull I have ever watched on youtube ! I have been looking for such video for a long time. Thank you so much, liked and subscribed to your channel. You made my day!

GarageCreativity
Автор

Wow man i really hope your channel succeeds! It is so awesome, keep up the good work!

aljosaskorjanc
Автор

great video Luuk - definitely going to refer to this in my next project, cheers!

ConcreteJungleGames
Автор

My Lord, this man just got another subscriber

orwell
Автор

Thank you so much for this great information! I really hope you keep making great videos like this one. Subbed and I've told all my subs (currently 9, 700+) about it. Well done sir!

thepolygonpilgrimage
Автор

Never thought about sprite sizes since i had all the power of pc. This info will deffinately be worth a while exporting for webgl and mobile. Thanks! Subscribed!

PyroPhysicsGames
Автор

Nice and simple tips to apply in your game, took me 5 minutes to halve the build size!!! Thanks

LaCreArthur
Автор

is it even posible to make low mb game like 5 MB etc, cause from what I see in my build editor log my small game that's pixel art takes Total User Assets 8.6 MB but it says Complete build size 71.6 MB? what are those other 63 mb?

JonelKingas
Автор

Best texture size optimization video ever

GokdenizCetin
Автор

6:00 You should increase the game preview scale to 1.0 to get an actual representation of what your assets will look like in the specified resolution.

Primu
Автор

Holy crap. Wish I had this info before my texture size went up to 3.4 gb but thanks!!!

eriknastesjo
Автор

Actually very usefull, thanks for the tips

aurelianobuendia
Автор

very appreciated your hard work and understandable tutorial thank you so much

darkkinght