How to add 1 to a PlayerPrefs
So I have a boss called fields slime (FS) and I want to make it so that when it is defeated there is a stored int value that indicates that it is defeated bool b = true; static int c;
void Start() { rb = GetComponent<Rigidbody2D>(); Retry.gameObject.SetActive(false); ToTitle.gameObject.SetActive(false); GameOverText.gameObject.SetActive(false); //boss PlayerPrefs.SetInt("FS defeated", c); PlayerPrefs.GetInt("FS defeated"); }
//bosses if (SceneManager.GetActiveScene().buildIndex == 3 && boss.GetComponent<FieldsSlime>().HP <= 0 && b == true) { int v = PlayerPrefs.GetInt("FS defeted"); int vc = v + c; PlayerPrefs.SetInt("FS defeated", vc); PlayerPrefs.Save(); print("Saved!"); b = false; }
Help would be very much appreciatied!
Your answer
Follow this Question
Related Questions
Highscore not working 0 Answers
Android Game Save and Load doesn't work 0 Answers
High-score Saving Issue 2 Answers
how do i store highscore locally C# (SIMPLE) 3 Answers
PlayerPrefs help ! 1 Answer