I have been able to save ammo, health, score to playerprefs and retrieve it upon “load game” but the final hurdle is trying to save a player inventory item “hasKey” I know it’s a bool where the other attributes are int, but I can’t even get player prefs to set it as an int. in the script, I am trying to say that if the bool hasKey is true, then setint in playerprefs = 1. Thne to see if it worked is the line where savedKey should =1 by Getint. I’ll worry about converting that value of 1 into something I can use but first I need to get it to save and load. I am just perplexed about this. I am following the same pattern I did for setting and getting ints for health, ammo and score
using UnityEngine;
using System.Collections;
public class PlayerInventory : MonoBehaviour
{
public bool hasKey;
public int keyToSave = 1;
public int savedKey;
void UpDate(){
savedKey = PlayerPrefs.GetInt("haveKeys");
if (hasKey == true)
PlayerPrefs.SetInt("haveKeys", keyToSave);
}
}