Skip to content

Extended version of PlayerPrefs to make life easier

Notifications You must be signed in to change notification settings

JamesVeug/Storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Storage

Wrapper for PlayerPrefs to add in additional functionality to make life easier

Setup:

  1. Copy Assets/Storage.cs into your project

Saving:

  1. Use Storage.instance.Save to save the data that you need

example:

// Primatives
Storage.instance.Save("playerName", "JamesGames")
Storage.instance.Save("playerAge", 29)

public enum PlayerTypes{
  SinglePlayer = 0,
  Multiplayer = 1
}
Storage.instance.Save("playerType", PlayerTypes.SinglePlayer)

// Lists
List<string> playerList = ...;
Storage.instance.SaveList("players", playerList);

Loading:

// Primatives
string playerName = Storage.instance.Load("playerName", "I need a new name!")
int playerAge = Storage.instance.Load("playerAge", -1)
PlayerTypes playerType = Storage.instance.Load("playerType", PlayerTypes.SinglePlayer)

// Lists
List<string> players = Storage.instance.LoadList<string>("players", new List<string>())

About

Extended version of PlayerPrefs to make life easier

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages