Unity3D 4.6.2 Build Crash Out Of Memory

Hello,

I am building a 2D adventure game using Unity. I have a total of 6000 sprites at 1024x1024 resolution, PNG at 32b, and about 42 animations for now, built using Unity Animator.
My resources folder is 163 MB.

When I try to build the game on Windows, I get the following crash:
41030-capture.png

Can’t Unity handle that many sprites? Is there another solution for this?

Also a while back, when I had fewer animations and sprites, the built game used about 3.87GB of disk space, while my entire resources folder was around 150MB. How is that possible?

Please let me know if I am missing something or if I should approach this differently.
Here is a small video of my game and what I am trying todo: - YouTube

Thanks in advance.

Unfortunately if unity wants to pack these sprites or add them to a Resources file it has to load all of them into memory which is impossible in your situation.

The only way you’ll get that many to work is to load them individually from StreamingAssets or make asset bundles out of smaller groups of them.

Hello,

To reduce memory what I first changed is that I removed mirror sprites. Now I implemented the “left is right” animations and I flip them from code. This removed like half of the memory usage. But my game was still 1.6 GB.

Next what helped me alot with all the sprites I had is Texture Packer. Not only does it squeeze multiple sprites into one image, but also it can detect similar sprites and include them only once in the image, but keep in sprite sheet the multiple references. That’s awesome. Now my game is only 160 MB, it saved me 10 times the memory usage.

I hope someone else finds this useful. I might look into asset bundle solution too later on, and I will be back with information on that one.