Easily encrypt your serialized classes and PlayerPrefs!
Replaces PlayerPrefs with an encrypted implementation.
Features:
- Easy to use!
- Supports serialized classes!
- Tight and very short code.
- Works also on mobile!
- Only two scripts!
Output
Demoscript
using UnityEngine;
using System.Collections;
using SecPlayerPrefs;
public class SecurePlayerPrefsDemo : MonoBehaviour {
void Start () {
//Write
SecurePlayerPrefs.SetFloat("float", 0.1f);
SecurePlayerPrefs.SetBool("bool", true);
SecurePlayerPrefs.SetInt("int", 100);
SecurePlayerPrefs.SetString("string", "amazing!");
//Read
Debug.Log(SecurePlayerPrefs.GetFloat("float"));
Debug.Log(SecurePlayerPrefs.GetBool("bool"));
Debug.Log(SecurePlayerPrefs.GetInt("int"));
Debug.Log(SecurePlayerPrefs.GetString("string"));
//Serialized Classes
//Write
SecureplayerPrefsDemoClass c = new SecureplayerPrefsDemoClass();
SecureDataManager<SecureplayerPrefsDemoClass> dataManager = new SecureDataManager<SecureplayerPrefsDemoClass>("name");
c.incremental = true;
c.playID = "tester";
c.type = 10;
dataManager.Save(c);
//Read
SecureDataManager<SecureplayerPrefsDemoClass> dataManagerReader =
new SecureDataManager<SecureplayerPrefsDemoClass>("name");
c = dataManagerReader.Get();
Debug.Log(c.incremental);
Debug.Log(c.type);
Debug.Log(c.playID);
}
}
using System;
[Serializable()]//Important
public class SecureplayerPrefsDemoClass
{
public string playID { get; set; }
public int type { get; set; }
public bool incremental { get; set; }
public SecureplayerPrefsDemoClass()
{
this.playID = "";
this.type = 0;
this.incremental = false;
}
}