Search Unity

Textures get larger in Android build

Discussion in 'Android' started by zenforhire, Dec 1, 2014.

  1. zenforhire

    zenforhire

    Joined:
    Nov 5, 2012
    Posts:
    65
    Hi All,

    I'm new to porting to android and running into the 50Meg file limit.
    We have read the documentation on getting it smaller and it is size of Textures.

    Reading from the editor.log, it looks like textures are 1.5 to 2 times the size in the project.
    They are expanding instead of compressing.
    There are dozens of Textures that are the same size.

    Thanks,
    Kevin
     
  2. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    What is the original texture format and what is the target format you picked for Android?
     
  3. zenforhire

    zenforhire

    Joined:
    Nov 5, 2012
    Posts:
    65
    In Build Settings: texture settings: don't override.

    in the texture:
    no override
    in the preview of the texture it is 1024x1024 rga compressed pvrtc 4 bits 0.7mb

    Here are a few examples of text sizes

    in project
    1.3Mb to 1.0mb

    In editor.log
    2.7 mb 1.0% Assets/living birds/Materials-Textures/sparrowDiffuseAlpha.png
    2.7 mb 1.0% Assets/living birds/Materials-Textures/robinDiffuseAlpha.png
    2.7 mb 1.0% Assets/living birds/Materials-Textures/cardinalDiffuseAlpha.png
    2.7 mb 1.0% Assets/living birds/Materials-Textures/blueJayDIffuseAlpha.png

    Thanks
     
  4. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Let's back up a bit. Did you read this http://docs.unity3d.com/Manual/android-GettingStarted.html - "ETC as Recommended Texture Compression" and this http://docs.unity3d.com/Manual/android-BuildProcess.html - "Texture Compression" ?

    If you have a lot of textures which requires alpha you can build GPU specific APKs to get the texture size down. This however won't solve the problem on devices which only support ETC1. For those devices you either need to down sample the texture or come up with an alternative plan of adding the alpha channel to get the size down.
     
  5. zenforhire

    zenforhire

    Joined:
    Nov 5, 2012
    Posts:
    65
    Thanks for directing me to the info.

    o change compression to "ETC"
    1.3 to 1.0 Mb images reduced to 682.8 kb

    o change GPU specific.
    This is one big feature I was missing.
    override for Android; max size = 256( birds are really small on phone)
    2.7 mb went down to 42.8 kb

    knocked apk down to 53Mb with GPU specific for most textures but still not good enough.
    NGUI atlases were screwed up doing this.

    I don't see this technique as a solution.
    As app grows, more GUI textures and atlases.

    o asset bundles
    I don't see anyway around this added complexity. Have to change all the Resource.Loads in my code and Other purchased assets code!?
    I just learned this is an Android Pro feature.
    Tough pill to swallow another $1500 to deploy to Google market.
     
  6. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
  7. zenforhire

    zenforhire

    Joined:
    Nov 5, 2012
    Posts:
    65
    Thanks again Martin.

    I have successfully split the binary.
    apk: 9.xxx kb obb: 49.xxx kb
    I have sided loaded the phone into the proper directories. Figuring out naming from different sources was confusing.
    It did find the OBB and start the game.
    I DID NOT NEED a new scene to do the loading. using android 4.x

    Download of the OBB from the GooglePlay is untested.
    So may run into another earning curve.
     
  8. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    If you deploy your game using the Unity Editor it should automatically upload both your APK and OBB to the connected device. If you put your game on Google Play you have to have some kind of mechanism to download the OBB from the first scene of your game. The first scene is the only thing that is present in the APK all additional scenes and resources end up in the OBB.

    The reasons why you (sometimes) need to make the download explicit is explained here:
    http://developer.android.com/google/play/expansion-files.html#DownloadProcess