Answers for "unity persistent data"

C#
-1

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();
}
Posted by: Guest on April-09-2020

C# Answers by Framework

Browse Popular Code Answers by Language