HomeIndex

User/Player Prefs

Prefs are stored on disk or in the cloud (if supported) and persist across play sessions. The location of the pref files changes by platform.
On the Mac, they can be found at: Application Support/COMPANY_NAME/GAME_NAME/
On Windows: AppData\Roaming\COMPANY_NAME\GAME_NAME\
The User prefs file is named Prefs.json and is user readable and editable.
The Private prefs file is Save.dat and is encrypted.
Pref files contain key/value pairs with the key being a string and the value an int, float, string, table or array.
getuserpref(key, default=null)
Returns a user pref for key.
If the key can't be found, default or null is returned.
skip_cutscenes = getuserpref("SkipCutscenes", true)
setuserpref(key, value)
Sets the user pref for key to value
setuserpref("SkipCutscenes", false)
getprivatepref(key, default=null)
Returns a private pref for key.
If the key can't be found, default or null is returned.
setprivatepref(key, value)
Sets the private pref for key to value
addprivatepref(key, value)
Adds value to the private pref with key
If 'key' doesn't exist or the type is not int or float, the key will be set to value. The primary use for this is to increment achievement values with a single command.
syncprefs()
Syncs user and private prefs to the disk or cloud (if supported).