Hello guys… I’m trying to save boolean values for some items in my game which only features are “you have it or you dont have it” = true, false
The items are: air, water, fire and earth gems
The problem is, I can save their values with “SetInt” using the code below
But how can I load the info?
here is my code
public void Save()
{
water = Controller.GetComponent<Manager>().waterGem;
air = Controller.GetComponent<Manager>().airGem;
fire = Controller.GetComponent<Manager>().fireGem;
earth = Controller.GetComponent<Manager>().earthGem;
saved = Controller.GetComponent<Manager>().hasSaved;
PlayerPrefs.SetInt("WaterGem", (water ? 1 : 0));
PlayerPrefs.SetInt("AirGem", (air ? 1 : 0));
PlayerPrefs.SetInt("EarthGem", (earth ? 1 : 0));
PlayerPrefs.SetInt("FireGem", (fire ? 1 : 0));
public void Load()
{
water = PlayerPrefs.GetInt("WaterGem", false);
Controller.GetComponent<Manager>().waterGem = water;
air = PlayerPrefs.GetInt("AirGem", false);
Controller.GetComponent<Manager>().airGem = air;
earth = PlayerPrefs.GetInt("EarthGem", false);
Controller.GetComponent<Manager>().earthGem = earth;
fire = PlayerPrefs.GetInt("FireGem", false);
Controller.GetComponent<Manager>().fireGem = fire;
}
the “load” function is definitely not working
please heeeeelp