I'm making a clicker game and in the game window the score goes up but when I build it and run it the score doesn't go up. I t$$anonymous$$nk it has somet$$anonymous$$ng to do with the click rate because when I deleted clicks += clicksRate to clicks++; it worked. The clicks go up by what the click rate is so if it is like 3 the clicks will go up by 3. Here is my code. There is somet$$anonymous$$ng wrong with Player prefs.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Score : MonoBehaviour
{
public int clicks;
public Text clicksText;
public int clicksRate;
void Start()
{
clicks = PlayerPrefs.GetInt("score");
clicksRate = PlayerPrefs.GetInt("clicksrate");
}
// Update is called once per frame
void Update()
{
clicksText.text = "Subs: " + clicks;
PlayerPrefs.SetInt("score", clicks);
PlayerPrefs.SetInt("clicksrate", clicksRate);
}
public void Click()
{
clicks += clicksRate;
}
}
↧