- Home /
Save quantities
I don't know how to explain it, so I'll give an example: I have a game and I'm at level 1 (for example) and I used 3 bullets, but when I go to level two I have all the bullets again, I would like to know how I can get through of levels without restarting the quantities of bullets and keeping the ones I had when I finished the previous level.
Comment
Answer by Flx24 · Jun 15, 2020 at 04:17 AM
You can make the bullet variable static:
public static int bullets;
If you want to save them use PlayerPrefs:
// saving the bullets
PlayerPrefs.SetInt("bullets", bullets);
// loading the bullets
bullets = PlayerPrefs.GetInt("bullets");
Your answer
![](https://koobas.hobune.stream/wayback/20220613000943im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Help setting up a game manager 1 Answer
How to add score after destroying object in unity 2D? 1 Answer
sound.Play() will not work 1 Answer
Camera to move when i move to the next room 1 Answer
Player is not moving 0 Answers