xariaa
xariaa

Reputation: 11

Unity3D Resources Folder and memory

I'm currently trying to understand how Unity creates its builds because my teams is creating a texture heavy game and it's crucial that we have enough memory for the game to function in the various environments (specifically web and iOS).

To test out the memory, I created a scene with a 166MB Resources folder and a cube. If you want to try it you can download it here: http://www.mediafire.com/?a137tz6anatf6qi. The cube's for debugging purposes: When the scene is just loaded, it's green. It changes to blue and a second later starts to load all the textures in Resources. When it turns red it unloads all unused assets (which is basically everything because I didn't assign the textures to anything).

Now I've read about the disadvantages of Resources folder in various places, but my issue is: with an empty scene and one game object, when the scene just starts, the process already takes up more than 600MB in the task manager!! After loading all Resources, it goes up to 1.3GB. Why? What is the 600MB that is being loaded? And how come the Resources folder bloats up by ~6 times?? I read something about the compression actually increasing the file size of the images, is that true?

Upvotes: 1

Views: 9001

Answers (1)

Petrucio
Petrucio

Reputation: 5679

You do not specify if you are running a build or in editor mode. I'm guessing you are running in editor mode, and I think Unity loads all resources in editor mode in case you want to change something on the fly.

Make an actual build of your cube test project and re-check the memory usage. According to this, it will not even put your unused resources in the build (and as far as my experience goes, that is true).

Unity is already very efficient on doing what you want (outside the editor mode), so I think you shouldn't have to worry too much with it. Take a trial version of Unity IOs and build your cube project for actual device testing.

This page lists texture compression types you can use for each platform. You may want to check out: "RGB Compressed PVRTC 2 bits Compressed RGB texture. Lower quality format suitable for diffuse textures. 2 bits per pixel (16 KB for a 256x256 texture)"

Upvotes: 1

Related Questions