Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Is there a limit to the file storage size of "Application.persistentDataPath" in Android/iOS?

Discussion in 'Editor & General Support' started by mikejm_, Dec 9, 2022.

  1. mikejm_

    mikejm_

    Joined:
    Oct 9, 2021
    Posts:
    346
    I am using Application.persistentDataPath to cache multimedia files which may add up. I can easily manage this to delete unused files and keep the folder not too big. But I am wondering if Android/iOS have any internal monitoring for the size of this folder and will throttle me at some point.

    I presume the operating systems would not let me expand this folder until the entire hard drive space is used, or would they? I don't intend to do so but I need to know if they will crash my app or do something else past a certain storage.

    Secondary to this question, to help with space management, is there any way (even with native iOS/Android code) to detect the amount of free disk space so I know how much room I overall have to work with as well? This would help me know how much I can cache.

    Thanks for any thoughts on either point.
     
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,363
    It's not a good plan to find out how much space is free, to decide how much you can take later. Other things can happen to the available space at any time. Write a 5MB / 5GB / 5TB file and if it fails, your app has an answer and can decide. That said, if I ever saw a game app taking a huge portion of my space without asking me first, it would be un-installed immediately, followed by a ★ review.