Skip to content

This is a wrapper for the UnityEngine.PlayerPrefs API

Notifications You must be signed in to change notification settings

murphyne/PlayerPrefsWrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Usage

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;
}

About

This is a wrapper for the UnityEngine.PlayerPrefs API

Topics

Resources

Stars

Watchers

Forks

Languages