Search Unity

Player Prefs Plist Magic!

Discussion in 'Editor & General Support' started by Moradom, Sep 8, 2014.

  1. Moradom

    Moradom

    Joined:
    Oct 10, 2011
    Posts:
    33
    Hello,

    I am working on an Android game using Unity's pro Android for Mac. I am trying to test out some security features that deal with detecting modifications on the player prefs Plist. Each time I modify the Plist located at ~/Library/Preferences/... outside of the editor (editor is even closed while doing this) it will be rewritten to that last save configuration. None of my external changes to this file seem to matter (I even delete the Plist and it will be regenerated again to the lasted saved configuration).

    I have disabled any code in my game that will construct the game data. So I know for certain that my game is not reconstructing this. This is what it seems like to me and I wanted to know if this is correct or if someone else can validate this.

    The Plist located at ~/Library/Preferences/... for Android/Mac is just a write file, never read by the Unity editor. The saved player prefs data is possibly meta data embedded within the Unity project and while working in the editor this data is loaded. Any changes to the player prefs data is changed in the "metaData" as well as being written to the Plist located ~/Library/Preferences/.... but it is never read from ~/Library/Preferences/MyPlist.

    I don't understand why I am seeing this behavior. Is it because I am using Unity's Android plugin and it deals with the Plist differently in the editor then a standalone Mac application?

    Thanks!
     
  2. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,038
    Have you seen the movie In the Mouth of Madness? Those particular plists are a bit like that. They're locked by cfprefsd, which does all sorts of mystical things to the default preferences of programs you've started since logging into the computer. Short version: Open a terminal and use "defaults delete <com.something or whatever for your app>" to delete them, or read up on how you change individual keywords. It's all fairly straight-forward with the defaults program, but you can't rewrite the file directly anymore since 10.9.

    But you're right that some of the real data is in the project. This is to make sure you can move your projects exactly as is, with any window settings preserved.
     
    Moradom likes this.
  3. Moradom

    Moradom

    Joined:
    Oct 10, 2011
    Posts:
    33
    Ahh that makes sense , thank you the info Orb! I will look into that