Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Why Unity doesn't support PNG in the built package?

Discussion in 'Editor & General Support' started by andersonsilva, Sep 25, 2014.

  1. andersonsilva

    andersonsilva

    Joined:
    Jul 29, 2013
    Posts:
    10
    For mobile game, package size is crucial. But Unity can only use true color or hardware compressed format for image files, no matter what their imported formats are.
    UI images have zero tolerance for compression, and as a result we have a 60Mb package only for the UI part.

    I know a work around is storing all the png files as bytes file and load them at run time. But I'm using NGUI, and this would only work if I modified NGUI profoundly.

    Has anybody encountered similar issues and are there better solutions?
     
  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    The question is ,what is eating up so much space in your GUI?
    I have mad a game with a complex GUI and a whole racing game in just 51Mb for on iOS. (With NGUI)
    If you are using the 9 splice correctly you can cover a lot of GUI with minimal space.
    I got all the icons , flags GUI backgrounds in just one 1024X1024 texture.
    The fonts where bitmaps fronts (at the time of the project dynamic fonts for mobile was not a ting).
    EU font normal(1kx1k) + Double size for HD(2kx2k)
    CN font normal(1kx1k) + Double size for HD (2kx2k)
    Today i would use a dynamic font for slimming the size down.

    If you have so much complex GUI that you cant get it down that much then that's the way it is.
    If your app depends on this complex GUI its worth the size.
     
  3. andersonsilva

    andersonsilva

    Joined:
    Jul 29, 2013
    Posts:
    10
    But if I use cocos2d-x for example, I can comfortably use png files for all my texture atlas, and the resulted package size would be tremendously smaller. Currently all my pngs files are less than 20Mb.
    So there is huge room for improvement.

    I just don't understand why Unity is the way it is now. Why can't it store image files in a compressed format that doesn't sacrifice quality?
     
  4. andersonsilva

    andersonsilva

    Joined:
    Jul 29, 2013
    Posts:
    10
    I found that 2d toolkit supports PNG atlas:
    "Atlas format - Allows you to choose how the atlas is stored. For example, you may choose to store the atlas as a png file (png.bytes). This will decrease your game size quite significantly, but this comes at the cost of additional load times"

    This is great but I've already written UI in NGUI, which doesn't support PNG atlas.
    But clearly storing files in PNG format is hugely helpful! I hope Unity can support this in the future. It's a tradeoff between loading time and app size.
     
  5. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    The problem is the gpu cant read PNG fliles.
    PNG files are in a heavy compressed Format thats ok for viewing loading it if you have a half second time window, but on the Device you need maximum performance and you have not time for decompressing the PNG for into a format that the GPU can read.
    The available and mostly not very nice compression's that are available are GPU hardware supported formats (PNG is non of them).
     
  6. andersonsilva

    andersonsilva

    Joined:
    Jul 29, 2013
    Posts:
    10
    But for my case, I can use a spinner to indicate waiting for a UI view to load. The loading won't be too slow. I've done this a dozen of times in cocos2d-x, which uses PNG every where in the UI.
    The benefit is huge, the app size is significantly smaller.

    I hope Unity can give this option to us who should decide whether to increase time in decompressing in order to minimize app size.
     
  7. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287