Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<string> Inventory = new List<string>();
- void Start()
- {
- for (int i = 0; i < 8; i++)
- {
- Inventory.Add(PlayerPrefs.GetString("Inventory" + i));
- Debug.Log(PlayerPrefs.GetString("Inventory" + i));
- Debug.Log("Inventory" + i);
- }
- Debug.Log(Inventory[1]);
- }
- public void AddItem(string item)
- {
- Debug.Log(item);
- Inventory.Add(item);
- Debug.Log(Inventory[0]);
- }
- void Update()
- {
- if (Input.GetKeyDown(KeyCode.F5))
- {
- Debug.Log(Inventory[0]);
- Debug.Log("Saved");
- for (int i = 0; i < Inventory.Count; i++)
- {
- PlayerPrefs.SetString("Inventory" + i, Inventory[i]);
- Debug.Log("Inventory" + i);
- PlayerPrefs.Save();
- }
- Debug.Log(Inventory);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement