Хочу сделать сохранение и выгрузку переменных в игре , но происходит такая ошибка
Unity C# Player prefs does not contains a definition for ''?
Вот код
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class Clicker : MonoBehaviour
{
[SerializeField] int money;
public GameObject b1;
public GameObject b2;
public GameObject b3;
public GameObject b4;
public int bonusplus = 2;
public int bonusplus2 = 7;
public Text moneyText;
public int bonus = 1;
public int autoclickbonus2 = 0;
private void Update()
{
moneyText.text = money.ToString();
SaveGame();
}
public void SaveGame()
{
PlayerPrefs.bonusplus("bonusplus", bonusplus);
PlayerPrefs.bonusplus2("bonusplus2", bonusplus2);
PlayerPrefs.bonus("bonus", bonus);
PlayerPrefs.money("money", money);
PlayerPrefs.autoclickbonus21("autoclickbonus2", autoclickbonus2);
PlayerPrefs.Save();
Debug.Log("Game data saved!");
}
public void LoadGame()
{
bonusplus = PlayerPrefs.GetInt("bonusplus");
bonusplus2 = PlayerPrefs.GetInt("bonusplus2");
bonus = PlayerPrefs.GetInt("bonus");
autoclickbonus2 = PlayerPrefs.GetInt("autoclickbonus2");
money = PlayerPrefs.GetInt("money");
Debug.Log("Game data loaded!");
}
private void Start()
{
LoadGame();
}
public void ToShop()
{
SceneManager.LoadScene(1);
}
public void Return()
{
SceneManager.LoadScene(0);
}
public void ButtonClick()
{
StartCoroutine(Click());
PlayerPrefs.SetInt("money,", money);
}
public void Buy()
{
if (money >= 300)
{
bonus += bonusplus;
money -= 300;
b1.SetActive(false);
}
else
{
Debug.Log("Not enough money");
}
}
public void Buy2()
{
if (money >= 900)
{
b2.SetActive(false);
bonus += bonusplus2;
money -= 900;
}
else
{
Debug.Log("Not enough money");
}
}
public void Buy3()
{
if (money >= 3000)
{
b3.SetActive(false);
StartCoroutine(IdleFarm());
money -= 3000;
}
else
{
Debug.Log("Not enough money");
}
}
public void Buy4()
{
if (money >= 4000)
{
b4.SetActive(false);
autoclickbonus2 += 4;
money -= 4000;
}
else
{
Debug.Log("Not enough money");
}
}
IEnumerator IdleFarm()
{
yield return new WaitForSeconds(1);
money += autoclickbonus2;
Debug.Log(money);
StartCoroutine(IdleFarm());
}
IEnumerator Click()
{
money += bonus;
yield return new WaitForSeconds(1.5f);
}
}