-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# PlayerPrefs Wrapper | ||
|
||
This is a wrapper for the UnityEngine.PlayerPrefs API. | ||
|
||
|
||
## Features | ||
|
||
- Cleaner syntax for working with the PlayerPrefs API. | ||
- Type safety for saving and retrieving data. | ||
- Support for multiple data types, including int, float, string, bool. | ||
|
||
|
||
## Installation | ||
|
||
- Download the .tgz file from [Releases][Releases]. | ||
- Add the .tgz file to your Unity project [using the Package Manager][UPM-Tarball]. | ||
|
||
[Releases]: | ||
https://github.com/murphyne/PlayerPrefsWrapper/releases | ||
|
||
[UPM-Tarball]: | ||
https://docs.unity3d.com/Manual/upm-ui-tarball.html | ||
|
||
|
||
## Usage | ||
|
||
```csharp | ||
using PlayerPrefsWrapper; | ||
|
||
public class Options | ||
{ | ||
// Create an instance of wrapped PlayerPrefs value. | ||
// Specify a key and an optional default value. | ||
private readonly PlayerPrefBool _option1 = new PlayerPrefBool("Option1", true); | ||
|
||
// Get value from PlayerPrefs. | ||
public bool GetOption1() => _option1.Value; | ||
|
||
// Set value to PlayerPrefs. | ||
public void SetOption1(bool value) => _option1.Value = value; | ||
} | ||
``` |