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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Broken Cache after Android 6.0 Upgrade

Discussion in 'Android' started by Johny_G, Mar 10, 2016.

  1. Johny_G

    Johny_G

    Joined:
    Mar 28, 2014
    Posts:
    20
    Hi guys!

    We have a strange issue with our Unity 5.2.4f1 Android builds. If the game was played on older Android and was then upgraded to Android 6.0 (via OTA update; reported on many nVidia Shield Tablets and recently Samsung Galaxy S6 and S6 Edge, since the updates started to roll out).

    After the upgrade, the cache gets corrupted and all static objects (lightmapped) load in pitch black, with no textures on it. Characters, particles and GUI Sprites are not affected, but the rest of scene is missing.

    It does help to clear cache within Application Info, but I have no clue whether it is possible to clear it from within Unity, since it is not that easy to explain the process to casual Android users. According to documentation, Caching.ClearCache only affect AssetBundles and Procedural Materials, so it seems like a no-go, since we don't use any of those (unless, of course, AssetBundles also include the monolithic OBB file). Also, I have no clue on how often is it safe to clear the cache without affecting performance. Does anybody have any ideas or solution for that?

    Thank you very much!
     
  2. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    This is just a guess, but this problem could be related to compiled shader binaries that are stored in the cache directory on Android.
    If you have a device that shows the issue you could try to delete the "UnityShaderCache" (e.g. "
    /data/data/com.app.name/cache/UnityShaderCache") directory. Or use the Unity API function "Handheld.ClearShaderCache()".

    We rely on the format info provided by the OpenGL ES driver to decide if a cached binary shader is outdated.
     
    Last edited: Mar 10, 2016
  3. Johny_G

    Johny_G

    Joined:
    Mar 28, 2014
    Posts:
    20
    Unfortunately, all of our devices are already updated, so it might be a little tricky to reproduce. I guess I will try to downgrade some.