Search Unity

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:
    9
    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:
    31
    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:
    145
  4. Sneeza

    Sneeza

    Joined:
    Aug 6, 2017
    Posts:
    9
    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

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    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:
    9
    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:
    9
    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:
    9
    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:
    15
    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.
     
    paxtonmason likes this.
  10. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    291
    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.
     
  11. paxtonmason

    paxtonmason

    Joined:
    Sep 17, 2012
    Posts:
    8
    Hey, my team has run into what sounds like the same issue, and it's caused a lot wasted time dealing with broken builds. Is there a defect filed in the unity issue tracker?
     
  12. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    291
    I found that the images that were causing build to fail when switching platform were all "power-of-two" images. Namely, only images that are "512x512" or "1024x1024" etc are causing this issue. As I had said earlier, I fixed this issue by toggling the “override to standalone” in the import setting, which implied that Unity failed to compress these images when switching platform from mobile (Android or iOS) to standalone.
     
  13. tim-unity

    tim-unity

    Joined:
    Feb 22, 2013
    Posts:
    15
    Issue 1117430 was added to the bug tracker for this, but I don't think it has been made public. The issue is still unresolved in a mainline release as of today I believe.
     
  14. SevenPointRed

    SevenPointRed

    Joined:
    Feb 3, 2016
    Posts:
    218
    Just to chime in, I get this also when swapping texture compression overrides on android, or moving between x86/Arm builds. I need to reimport all textures manually whenever swapping.
     
  15. EscalatorSafe

    EscalatorSafe

    Joined:
    Apr 12, 2018
    Posts:
    21
    I can confirm we also get this issue. For a long time we thought light baking on windows platform was incompatible with android as our bake results were always messed up by the platform switch, turns out unity just wasnt re importing the textures.
     
  16. claytoncurmi

    claytoncurmi

    Joined:
    Jul 6, 2010
    Posts:
    168
    @Unity - please fix this issue as soon as possible as it is a major headache and a time waster. Asset bundles already taking too long to build and I can't operate like this in an agile environment. I am using Unity 2018.2.20f1 and for technical reasons, we can't update to versions > 2018.2.
     
  17. LeleUnity

    LeleUnity

    Joined:
    Jul 30, 2016
    Posts:
    97
    I have it here in 2017 lts latest update !! any help?
     
  18. SevenPointRed

    SevenPointRed

    Joined:
    Feb 3, 2016
    Posts:
    218
    Just jumping in again as its been a long time without a unity response and this still happens in the latest version
     
    nagpalrajeev likes this.
  19. SevenPointRed

    SevenPointRed

    Joined:
    Feb 3, 2016
    Posts:
    218
    Also still exists in 2019.1
     
    EscalatorSafe likes this.
  20. unity_Jo6zuYKWQcetFQ

    unity_Jo6zuYKWQcetFQ

    Joined:
    Dec 29, 2017
    Posts:
    2
    hi,
    plaise help me same error but in unity 2019.3.0a5

    Debug log :

    DXT1 compressed textures are not supported when publishing to iPhone
    Resources/unity_builtin_extra
    Included from scene:
    0 Unity 0x000000010f08213f _Z13GetStacktracei + 95
    1 Unity 0x0000000111849a54 _Z17DebugStringToFileRK21DebugStringToFileData + 356
    2 Unity 0x000000010e61d572 _Z23VerifyFeatureDeploymentP6Object19BuildTargetPlatform + 2082
    3 Unity 0x000000010e613209 _Z16VerifyDeploymentP6Object19BuildTargetPlatform + 1273
    4 Unity 0x000000010ef2fdcc _ZN17PersistentManager9WriteFileERKN4core12basic_stringIcNS0_20StringStorageDefaultIcEEEEiPK9WriteDataiRK15GlobalBuildDataPF23VerifyWriteObjectResultP6Object19BuildTargetPlatformE20BuildTargetSelection24TransferInstructionFlagsR16WriteInformationPK18InstanceIDResolverNS_9LockFlagsE + 3084
    5 Unity 0x000000010ef2f093 _ZN17PersistentManager9WriteFileERKN4core12basic_stringIcNS0_20StringStorageDefaultIcEEEEiPK9WriteDataiRK15GlobalBuildDataPF23VerifyWriteObjectResultP6Object19BuildTargetPlatformE20BuildTargetSelection24TransferInstructionFlagsPK18InstanceIDResolverNS_9LockFlagsE + 179
    6 Unity 0x000000010e61235b _Z20WriteSharedAssetFileiRKN4core12basic_stringIcNS_20StringStorageDefaultIcEEEERKNSt3__13mapIi10BuildAssetNS6_4lessIiEENS6_9allocatorINS6_4pairIKiS8_EEEEEERK19BuildUsageTagGlobal20BuildTargetSelectionPFviR31LocalSerializedObjectIdentifierPvE24TransferInstructionFlagsRNS6_3setI12ResourceFileNS9_ISU_EENSB_ISU_EEEER10vector_mapIi26SerializedObjectIdentifierSA_NSB_INSC_IiS10_EEEEE + 1099
    7 Unity 0x000000010e613597 _Z23CompileSharedAssetsFileiRKN4core12basic_stringIcNS_20StringStorageDefaultIcEEEES5_RKNSt3__13mapIi10BuildAssetNS6_4lessIiEENS6_9allocatorINS6_4pairIKiS8_EEEEEERK19BuildUsageTagGlobalRK20BuildTargetSelection24TransferInstructionFlagsRNS6_3setI12ResourceFileNS9_ISR_EENSB_ISR_EEEER10vector_mapIi26SerializedObjectIdentifierSA_NSB_INSC_IiSX_EEEEERN14BuildReporting11BuildReportE + 135
    8 Unity 0x000000010e62b966 _ZL15BuildPlayerData24BuildTargetPlatformGroup19BuildTargetPlatform18BuildPlayerOptionsRK16BuildCompressionNSt3__16vectorIN4core12basic_stringIcNS7_20StringStorageDefaultIcEEEENS5_9allocatorISB_EEEEP20AssetBundleBuildDataRNS6_I17EditorSceneBackup13stl_allocatorISH_L18MemLabelIdentifier116ELi16EEEE18ScriptingObjectPtr8Vector2fRN14BuildReporting11BuildReportERKSB_PNSP_20BuiltAssetBundleInfoEST_ + 12038
    9 Unity 0x000000010e600753 _Z13DoBuildPlayerRK16BuildPlayerSetupRNSt3__16vectorI17EditorSceneBackup13stl_allocatorIS4_L18MemLabelIdentifier116ELi16EEEEN4core12basic_stringIcNSA_20StringStorageDefaultIcEEEENS3_ISE_NS2_9allocatorISE_EEEEbRN14BuildReporting11BuildReportEPNSI_20BuiltAssetBundleInfoERKSE_ + 3587
    10 Unity 0x000000010e605196 _Z11BuildPlayerRK16BuildPlayerSetupRN14BuildReporting11BuildReportE + 4102
    11 Unity 0x000000010f74fa94 _Z47BuildPipeline_CUSTOM_BuildPlayerInternalNoCheckP36ScriptingBackendNativeArrayPtrOpaqueP37ScriptingBackendNativeStringPtrOpaqueS2_24BuildTargetPlatformGroup19BuildTargetPlatform18BuildPlayerOptionsh + 1204
    12 (Mono JIT Code) (wrapper managed-to-native) UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,UnityEditor.BuildOptions,bool)
    13 (Mono JIT Code) [BuildPlayerWindowBuildMethods.cs:170] UnityEditor.BuildPlayerWindow/DefaultBuildMethods:BuildPlayer (UnityEditor.BuildPlayerOptions)
    14 (Mono JIT Code) [BuildPlayerWindowBuildMethods.cs:96] UnityEditor.BuildPlayerWindow:CallBuildMethods (bool,UnityEditor.BuildOptions)
    15 (Mono JIT Code) [BuildPlayerWindow.cs:913] UnityEditor.BuildPlayerWindow:GUIBuildButtons (UnityEditor.Modules.IBuildWindowExtension,bool,bool,bool,UnityEditor.Build.BuildPlatform)
     
  21. SevenPointRed

    SevenPointRed

    Joined:
    Feb 3, 2016
    Posts:
    218
    Still exists in 2021.1