PlayerPrefs Extensions
Set String
This method Sets a string value to PlayerPrefs using the specified key. The string can optionally be encrypted using a custom key for added security.
Get String
This method retrieves a string from PlayerPrefs using the specified key. If the key doesn't exist, it returns an empty string. It decrypts the string if it was Setd in an encrypted format.
Delete String
This method deletes a string value from PlayerPrefs associated with the specified key. Useful for removing stored data when it's no longer needed.
Has String
This method checks if a string value exists in PlayerPrefs for the given key. It returns true if the key is found, otherwise false.
Set Char
This method Sets a character value to PlayerPrefs under the specified key. The character is converted to a string and can be encrypted for additional protection.
Get Char
This method Gets a character from PlayerPrefs using the specified key. If the key is missing, it returns a default character like \0 or 'B'.
Delete Char
This method deletes a character value from PlayerPrefs for the specified key.
Has Char
This method checks whether a character value exists in PlayerPrefs for the given key.
Set Int
This method Sets an integer value to PlayerPrefs. The integer is converted to a string and encrypted for security before saving.
Get Int
This method Gets an integer value from PlayerPrefs for the given key. If the key does not exist, it returns a default value like 0.
Delete Int
This method deletes an integer value from PlayerPrefs associated with the specified key.
Has Int
This method checks whether an integer value exists in PlayerPrefs for the specified key.
Set Float
This method Sets a float value to PlayerPrefs using the specified key. The float value is encrypted if a custom key is provided.
Get Float
This method retrieves a float from PlayerPrefs. If the key does not exist, it returns a default value like 0f or 3.0f.
Delete Float
This method deletes a float value from PlayerPrefs for the specified key.
Has Float
This method checks if a float value exists for a given key in PlayerPrefs.
Set Bool
This method Sets a boolean value to PlayerPrefs using a key. The boolean value is converted to a string and can be encrypted.
Get Bool
This method retrieves a boolean from PlayerPrefs. If the key is missing, it returns a default value like false.
Delete Bool
This method deletes a boolean value from PlayerPrefs for the specified key.
Has Bool
This method checks if a boolean value exists for the given key in PlayerPrefs.
Set Double
This method Sets a double value to PlayerPrefs. It converts the double to a string and encrypts it if needed.
Get Double
This method retrieves a double from PlayerPrefs. If the key does not exist, it returns a default value like 0d or 50.0.
Delete Double
This method deletes a double value from PlayerPrefs for the specified key.
Has Double
This method checks if a double value exists in PlayerPrefs for the given key.
Set Long
This method Sets a long integer value to PlayerPrefs. The long value is encrypted before storing it if a custom key is provided.
Get Long
This method retrieves a long value from PlayerPrefs. If the key is not found, it returns a default value like 0L.
Delete Long
This method deletes a long integer value from PlayerPrefs for the specified key.
Has Long
This method checks if a long value exists for the specified key in PlayerPrefs.
Set Short
This method Sets a short value to PlayerPrefs with optional encryption using a custom key.
Get Short
Retrieves a short value from PlayerPrefs. Returns a default value like 0 if the key is not found.
Delete Short
Deletes the short value from PlayerPrefs for the given key.
Has Short
Checks if a short value exists for the given key in PlayerPrefs.
Set Byte
Sets a byte value to PlayerPrefs, with optional EncryptExtensions.
Get Byte
Gets a byte value from PlayerPrefs, returning a default value if the key does not exist.
Delete Byte
Deletes the byte value from PlayerPrefs for the given key.
Has Byte
Checks if a byte value exists for the specified key in PlayerPrefs.
Set Vector2
Sets a Vector2 (X, Y) to PlayerPrefs by storing each component (x, y) separately.
Get Vector2
Gets a Vector2 from PlayerPrefs, returning the default value if the key does not exist.
Delete Vector2
Deletes the Vector2 value (both x and y components) from PlayerPrefs for the given key.
Has Vector2
Checks if a Vector2 exists by confirming both x and y components are stored in PlayerPrefs.
Set Vector3
Sets a Vector3 (X, Y, Z) to PlayerPrefs by storing each component (x, y, z) separately.
Get Vector3
Gets a Vector3 from PlayerPrefs, returning a default value if the key is missing.
Delete Vector3
Deletes the Vector3 value (x, y, z components) from PlayerPrefs for the specified key.
Has Vector3
Checks if a Vector3 exists by confirming all x, y, and z components are stored.
Set Vector4
Sets a Vector4 (X, Y, Z, W) to PlayerPrefs, storing each component separately.
Get Vector4
Gets a Vector4 from PlayerPrefs, returning a default value if not found.
Delete Vector4
Deletes the Vector4 value (x, y, z, w components) from PlayerPrefs for the specified key.
Has Vector4
Checks if a Vector4 exists by confirming all four components (x, y, z, w) are present.
Set Array
This method Sets an array of any type to PlayerPrefs by storing the length and each element separately. Optionally, you can encrypt the data using a custom key.
Get Array
Gets an array of any type from PlayerPrefs. If the array doesn't exist, it returns the default value provided (e.g., new string[] { "none" }).
Delete Array
Deletes an array from PlayerPrefs by removing the length and each element that was saved.
Has Array
Checks if an array exists in PlayerPrefs by verifying if the length of the array is stored.
Set Dictionary
Sets a dictionary of key-value pairs (of any type) to PlayerPrefs. It stores the count of dictionary entries, and each key and value separately.
Get Dictionary
Gets a dictionary from PlayerPrefs. If the dictionary doesn't exist, it returns the default dictionary provided (e.g., { { "none", 0 } }).
Delete Dictionary
Deletes a dictionary from PlayerPrefs by removing the length, keys, and values stored.
Has Dictionary
Checks if a dictionary exists in PlayerPrefs by verifying if the length of the dictionary is stored.
Clear All
This method deletes all PlayerPrefs data, including arrays, dictionaries, and individual values.
WARNING: THIS ACTION IS IRREVERSIBLE!
Last updated