![]() |
Anti-Cheat Toolkit
2024.3.5
Multi-purpose anti-cheat solution for Unity Engine
|
Static Public Member Functions | |
static void | SetRawValue (string encryptedKey, string encryptedValue) |
static bool | GetRawValue (string key, out string encryptedKey, out string encryptedValue) |
static bool | HasKey (string key) |
static void | DeleteKey (string key) |
static void | DeleteCryptoKey () |
static void | DeleteAll () |
static void | Save () |
static void | Set< T > (string key, T value) |
static T | Get< T > (string key, T defaultValue=default) |
static bool | MigrateFromACTkV1 (string key, string cryptoKey="e806f6") |
static string | EncryptKeyWithACTkV1Algorithm (string key, string cryptoKey="e806f6") |
Static Public Attributes | |
static bool | preservePlayerPrefs = false |
Properties | |
static DeviceLockSettings | DeviceLockSettings = new DeviceLockSettings() [get] |
Events | |
static Action | NotGenuineDataDetected |
static Action | DataFromAnotherDeviceDetected |
This is an Obscured analogue of the PlayerPrefs class.
Saves data in encrypted state, optionally locking it to the current device.
Automatically encrypts PlayerPrefs on first read (auto migration), has tampering detection and more.
Check out ObscuredFilePrefs if you wish to save big data amounts.
|
inlinestatic |
Allows to set the raw encrypted key and value.
|
inlinestatic |
Allows to get the raw encrypted key and value for the specified key.
|
inlinestatic |
Returns true if key
exists in the ObscuredPrefs or in regular PlayerPrefs.
|
inlinestatic |
Removes key
and its corresponding value from the ObscuredPrefs and regular PlayerPrefs.
|
inlinestatic |
Removes saved crypto key. Use only when you wish to completely remove all obscured prefs!
WARNING: Any existing obscured prefs will be lost after this action.
|
inlinestatic |
Removes all keys and values from the preferences, including anything saved with regular PlayerPrefs. Use with caution!
WARNING: Please use this method to remove all prefs instead of PlayerPrefs.DeleteAll() to properly clear internals and avoid any data loss when saving new obscured prefs after DeleteAll() call.
|
inlinestatic |
Writes all modified preferences to disk.
By default, Unity writes preferences to disk on Application Quit.
In case when the game crashes or otherwise prematurely exits, you might want to write the preferences at sensible 'checkpoints' in your game.
This function will write to disk potentially causing a small hiccup, therefore it is not recommended to call during actual game play.
|
inlinestatic |
Sets the value
of the preference identified by key
.
WARNING: Not all types are supported, see StorageDataType for list of supported types.
|
inlinestatic |
Returns the value corresponding to key
in the preference file if it exists. If it doesn't exist, it will return defaultValue
.
WARNING: Not all types are supported, see StorageDataType for list of supported types.
|
inlinestatic |
Use to migrate ACTk v1.* prefs to the newer format.
key | Prefs key you wish to migrate. |
cryptoKey | Custom crypto key you used for ObscuredPrefs, if any. Don't use this argument to utilize default key from ACTk v1. |
|
inlinestatic |
Use to encrypt ACTkv1's value key for later use with SetRawValue to let it migrate.
key | Prefs key. |
cryptoKey | Crypto key you used with ACTk v1, if any. |
|
static |
Allows saving original PlayerPrefs values while migrating to ObscuredPrefs.
In such case, original value still will be readable after switching from PlayerPrefs to ObscuredPrefs and it should be removed manually as it became unneeded.
Original PlayerPrefs value will be automatically removed after read by default.
|
staticget |
Controls DeviceLock feature settings. Read more at DeviceLockSettings docs.
|
static |
Allows reacting on saves alteration. May be helpful for banning potential cheaters.
Fires only once.
|
static |
Allows reacting on detection of possible saves from some other device.
May be helpful to ban potential cheaters, trying to use someone's purchased in-app goods for example.
May fire on same device in case cheater manipulates saved data in some special way.
Fires only once.
NOTE: May be called if same device ID was changed (pretty rare case though).