//Saving and loading equipment items: public void SaveEquipments() { int TempVar = 1; for (int i = 0; i < EquipmentSlots.Length; i++) //Starting a loop in the equipment slots. { if (EquipmentSlots[i].IsTaken == true) { Item ItemScript = EquipmentSlots[i].Item.GetComponent <Item>(); //Getting the item script. //I use Eq at the beginning so there player prefs don't get mixed with the inventory items player prefs. PlayerPrefs.SetInt("EqItemType" + TempVar.ToString(), ItemScript.ItemType); //Saving the item's type PlayerPrefs.SetFloat("EqMinDistance" + TempVar.ToString(), ItemScript.MinDistance); //Saving the item's pickup minimum distance. PlayerPrefs.SetString("EqName" + TempVar.ToString(), ItemScript.Name); //Saving the item's name. PlayerPrefs.SetInt("EqAmount" + TempVar.ToString(), ItemScript.Amount); //Saving the item's amount. PlayerPrefs.SetInt("EqWeight" + TempVar.ToString(), ItemScript.Amount); //Saving the item's weight PlayerPrefs.SetString("EqShortDescription" + TempVar.ToString(), ItemScript.ShortDescription); //Saving the item's short description. PlayerPrefs.SetString("EqCurrency" + TempVar.ToString(), ItemScript.Currency); //Saving the item's currency type. PlayerPrefs.SetInt("EqCurrencyAmount" + TempVar.ToString(), ItemScript.CurrencyAmount); //Saving the item's currency amount. PlayerPrefs.SetString("EqEquipmentSlot" + TempVar.ToString(), ItemScript.EquipmentSlot); //Saving the item's equipment slot. PlayerPrefs.SetString("EqSkillSlot" + TempVar.ToString(), ItemScript.SkillSlot); //Saving the item's skill bar slot. PlayerPrefs.SetInt("EqSlotID" + TempVar.ToString(), i); //Saving the item's skill bar slot. //Saving the item's equipment attributes: if (ItemScript.Attributes.Length > 0) { PlayerPrefs.SetString("EqHasAttributes" + TempVar.ToString(), "Yes"); PlayerPrefs.SetInt("EqAttributesAmount" + TempVar.ToString(), ItemScript.Attributes.Length); for (int x = 0; x < ItemScript.Attributes.Length; x++) { PlayerPrefs.SetString("EqAttributeName" + x.ToString() + TempVar.ToString(), ItemScript.Attributes[x].Name); PlayerPrefs.SetInt("EqAttributeValue" + x.ToString() + TempVar.ToString(), ItemScript.Attributes[x].Value); } } else { PlayerPrefs.SetString("EqHasAttributes" + TempVar.ToString(), "No"); } TempVar++; } } PlayerPrefs.SetInt("SavedEquipments", TempVar); EqUI.RefreshAttributes(); }