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. Dismiss Notice

Can users get files stored at the Application.persistentDataPath?

Discussion in 'Scripting' started by Mycroft, Jul 20, 2016.

  1. Mycroft

    Mycroft

    Joined:
    Aug 29, 2012
    Posts:
    160
    We download a lot of midi files to a user's mobile device (Android/iOS) and store them at the Application.persistentDataPath.

    How easy is it for a user to access those files and/or move them off the device and onto a PC/Mac?

    If it's too easy we will likely encrypt/obfuscate the files to prevent simple access
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,144
    I know on pc it's pretty easy.
    http://docs.unity3d.com/ScriptReference/Application-persistentDataPath.html

    It does say it's stored in a public folder. I'm not sure where it's stored on android/iOS, but a debug.log will tell you that.

    Honestly, you should encrypt anything you save to the players device if you want to try to prevent access. Your average user may not find it, but there are always those that will locate your saved files. Then there are those that will attempt (and succeed) to break your encryption. It's just a part of game development we deal with.

    So, yes, it's probably pretty easy for anybody who actually takes the time to look.
     
    Last edited: Jul 20, 2016
    jimroberts likes this.
  3. jimroberts

    jimroberts

    Joined:
    Sep 4, 2014
    Posts:
    560
    It's completely pointless to encrypt client side data because anyone that really wants to will be able to decrypt it within a short amount of time. You could try locking the files while the application is running and delete them when the application closes. Alternatively, just keep the file in memory. The downside to this is that you will need to send the files whenever the application is reopened. Is there some specific reason you don't want the users to access the files?
     
    Last edited: Jul 20, 2016
    Suddoha likes this.
  4. BenWilles

    BenWilles

    Joined:
    Mar 9, 2018
    Posts:
    41
    I'll dig this cause I face exactly same problem. application.persistentdatapath on iOS can simply be seen with tools like iexplorer. But tons of other games are not visible there. How they do it?
     
  5. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,144
    Pretty old post...but if the files are not stored locally on the device, they are most likely saved online.