Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Our response to Improbable’s blog post (and why you can keep working on your SpatialOS game). Read more here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Textures not compressing when building or switching platforms

Discussion in 'Editor & General Support' started by Sneeza, Dec 20, 2018.

  1. Sneeza

    Sneeza

    Joined:
    Aug 6, 2017
    Posts:
    8
    Hi all,

    I recently upgraded a project from 2017.4.4f1 to 2018.2.19f1 to get some significant performance gains, but when switching to build for different platforms I'm having serious problems. When swapping to a different platform, Unity re-processes all of the assets and in the editor they show up as "1024x1024 (Not yet compressed)" - however, when I try and build it fails with this error:

    Initially my iOS builds were showing up way larger than they should, and I realised that Unity just refused to compress to PVRTC format at all so I checked "Compress assets on import" and deleted my Library folder which fixed that issue. However, this new issue basically stops me from switching platforms and re-compiling which is essential for me.

    My last build was for iOS which uses the PVRTC textures, so it seems to be holding onto those and not realising that the cached texture is for a different target platform. I've tried using both the local cache server and running the unity-cache-server daemon manually but that still gives me the same problem (which is odd because that's running with an empty cache).

    This issue is happening on both my Macbook and Windows desktop, so I'm less inclined to believe that it's isolated to a configuration option on my end.

    Any ideas for debugging or something obvious I may be missing?
     
  2. fakegood

    fakegood

    Joined:
    Oct 11, 2013
    Posts:
    11
    hello, i got this problem on 2018.3.0f2 on Mac as well.. would love to have a solution too
     
  3. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    107
  4. Sneeza

    Sneeza

    Joined:
    Aug 6, 2017
    Posts:
    8
    That does seem to be the same issue, although I'm not seeing an actual bug tracking report for this issue specifically. Turns out it actually affects every platform and is not limited to only iOS, so every time I need to make a new build I have to reimport all of my asset folders which takes anywhere from 20m to 2h depending on the platform.
     
  5. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    3,013
    A Cache Server often speeds up this process significantly, if the problem is switching platforms:
    https://docs.unity3d.com/Manual/CacheServer.html
     
  6. Sneeza

    Sneeza

    Joined:
    Aug 6, 2017
    Posts:
    8
    I've been using the cache server for over a year and had no problems until I upgraded to 2018.2. The reason I have to reimport manually is because Unity fails to even attempt to fetch the textures that have been compressed for each platform and instead keeps the previous platform's textures when building. It seems to be an issue that a few people are experiencing according to the thread linked by sharkapps above.

    I did notice something interesting last night though - I cleared the Library folder and all of the Unity caches (including the cache server folder) and when I switch platforms within the editor I don't experience the bug at all. However, if I close the project and use Unity Hub to open it with a new platform then the issue re-appears and doesn't go away until I clear the caches again.

    It seems that an update to Unity Hub that happened in December may have started causing this issue with their fast-loading system for platforms. I haven't tested too deeply but it fixed the issue on both my desktop and laptop so far.
     
  7. Sneeza

    Sneeza

    Joined:
    Aug 6, 2017
    Posts:
    8
    After working for 2 days on both my machines I can confirm this issue only happens when you use Unity Hub's "Advanced Open" feature to swap the platform when opening the project. I've been using the Switch Platform feature exclusively inside the editor and not seen this error since.

    For anyone else having this issue - delete the Library folder, delete the Unity cache folders (including Cache Server) and then open the project by clicking on it in Unity Hub. If you accidentally open it using the Advanced Open feature you'll have to clear the caches again.
     
  8. Sneeza

    Sneeza

    Joined:
    Aug 6, 2017
    Posts:
    8
    Never mind - I'm pretty much at a loss as to the cause of this issue but I just tried to make an iOS build and magically the error returned forcing me to waste 1 hour re-importing all of the assets again.

    This seems like the exact same issue so I've added my comments to it and suggest anyone encountering this bug do the same: https://issuetracker.unity3d.com/is...n-build-after-switching-platform-from-android
     
  9. tim-unity

    tim-unity

    Joined:
    Feb 22, 2013
    Posts:
    14
    We hit this issue and have sent a repro to Unity. In our case, we found that UnityIAP is calling AssetDatabase.Refresh() before the async platform switch that the Files > Build Settings dialog now uses completes fully, leading to the symptoms described. A temporary work around is to switch platforms by calling EditorUserBuildSettings.SwitchActiveBuildTarget instead of using the File > Build Settings dialog - this still works ok.
     
  10. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    61
    I have the same problem but it is a little different. When I switch the platform to standalone, there is a chance that the build will fail and throw some errors mentioning that the compression format of some images is not supported. I workaround this issue by checking or unchecking the setting of “override to standalone” in the import setting of these images, that is to say, if it was checked then uncheck it, vice versa. So I am suspecting that the compression actually didn’t work. And I also have noticed that these errors only happened on certain images, other images has never caused the build to fail.