Hello Guest

Author Topic: Memory Issues for texture  (Read 8494 times)

Dipanker

  • Newbie
  • *
  • Posts: 17
    • View Profile
Memory Issues for texture
« on: November 05, 2013, 08:54:45 am »
Hi
   In my 2D game I am using many sprite of of atlas (512*512 of 3 atlas, 1024*1024 of 12 atlas and 2048*2048 of 16 atlas) which is for 2x devices only half of size for 1x and double for 4x devices is created. But all of this atlas is not for same scene, its changes according to level. But while in starting of my game I am using 3 2048*2048 atlas plus 1 1024*1024 atlas. In unity games work perfectly. But when I try to build (for IOS devices Setting) it takes much time and end up with fatal error which is : Could not allocate memory: System out of memory! Trying to allocate: 16777220B with 32 alignment. MemoryLabel: Texture
Allocation happend at: Line:388 in /Applications/buildAgent/work/cac08d8a5e25d4cb/Runtime/Graphics/Texture2D.cpp

How much size or memory is needed for atlas or texture to load?

As my system memory is 4GB DDR3 and HDD almost 40GB free. and I m using Unity4.2.1
So please please help me with this issues a I already posted my issues to unity but there is no response, my game is in the end but cannot able to load in device.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Memory Issues for texture
« Reply #1 on: November 05, 2013, 12:26:45 pm »
What device does it crash on? It just looks like you're running out of memory?

The amount of memory required for an atlas is shown when you select the texture in the project view. As a rule of thumb, if your texture is uncompressed, 1024x1024 = 4MB (5.333MB with mipmaps), 2k = 16MB (21.3MB with mipmaps).

Dipanker

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Memory Issues for texture
« Reply #2 on: November 05, 2013, 03:23:22 pm »
Thank you for the reply.
In first it doesn't build in unity so no option to put in device, when I try to build after few minutes its shows fatal error which I mention before.
What happens when I change the atlas sprite to compressed, and I saw in inspector view when I select the atlas its shows the texture type as Advanced, should I changed texture type to other format or leave it as it is?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Memory Issues for texture
« Reply #3 on: November 05, 2013, 03:58:33 pm »
If its at advanced, you should look at the "Format" drop down. Automatic truecolor = uncompressed.

Dipanker

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Memory Issues for texture
« Reply #4 on: November 06, 2013, 06:19:11 am »
when I used compress format in 2dtoolkit sprite collection my whole images within sprite collection is looking blur...

Dipanker

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Memory Issues for texture
« Reply #5 on: November 06, 2013, 06:38:31 am »
Sorry for more question...

1. Can I crop the atlas which is created on tk2dToolkit Sprite Collection? Because some of atlas taking all height but half of width is empty/wastage so can I crop it to reduce some size.

2. Is it necessary to keep an assets images of sprite collection when building game because I think in game play it is of no use all images is already in atlas.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Memory Issues for texture
« Reply #6 on: November 06, 2013, 11:52:55 am »
1. The atlas won't be taking half the width otherwise it would have halved it, it must be over by a small amount.
2. It doesn't get built into the game. You can verify this in the editor log after you've built.