unity store persistent data code example
Example: unity persistent data
private int health;
private void Load()
{
if(PlayerPrefs.HasKey("health"))
{
health = PlayerPrefs.GetInt("health");
}
}
private void Save()
{
PlayerPrefs.SetInt("health", health);
PlayerPrefs.Save();
}