Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Android Cache Growing with Unity Ads

Discussion in 'Unity Ads' started by Grawnya, May 14, 2019.

  1. Grawnya

    Grawnya

    Joined:
    Apr 5, 2018
    Posts:
    6
    Hi Everyone,

    On releasing my app and testing on my Android device, I notice that every time a video ad shows, the app's cache grows. I believe this is to be expected because ads are cached.

    But what happens when the cache fills up? I believe 50 GB is allocated. Should there be some code in my app that can check the cache and empty it if it is nearly full? Or will the underlying Unity code take care of this situation? In which case I shouldn't do anything.

    I have found this function ClearCache. Should I always call this on exit so that the cache never fills?

    https://docs.unity3d.com/ScriptReference/Caching.ClearCache.html

    Is this recommended practice? Is it dangerous to clear the cache while the app is still running - even though it's executed just before shutdown?

    I'd like to know how other people handle this issue.

    I'm building with Unity 2018.3.13

    Thanks a lot
    Grawnya
     
  2. DenisasK

    DenisasK

    Unity Technologies

    Joined:
    Oct 13, 2016
    Posts:
    89
    Hello, Unity Ads taking care of the cached files during init. If the cache size is bigger than 50mb, it will be cleared during init.
     
  3. Grawnya

    Grawnya

    Joined:
    Apr 5, 2018
    Posts:
    6
    Hi, that's good to know - thanks a lot for the reply.