Question by
Venatal · Dec 20, 2015 at 02:03 PM ·
c#playerprefsonclickcounter
Guidance on creating a ClickCounter
This is my script so far:
using UnityEngine;
public class ClickCounter : MonoBehaviour
{
public static ClickCounter manager;
public int CC;
void Start()
{
manager = this;
if (CC == 5)
{
InterstitialAdvert.manager.GameOver();
}
if (CC > 5)
{
ResetCount();
}
}
public void ClickCount()
{
CC = CC + 1;
PlayerPrefs.SetInt("clickCount", CC);
}
public void ResetCount()
{
CC = 0;
PlayerPrefs.SetInt("clickCount", CC);
}
}
As what I want my code to do I need it to do the following: - Each time the replay button is pressed the script logs it e.g if I press the replay button twice the count would be at 2 - if CC = 5 the Count resets to 0 - if the player exits the application the Count resets to 0 - when the replay button is pressed the count is saved in playerprefs Any help would be appreciated, thanks! I'd prefer explanations rather than showing me the actual script and keep the explanations simple please, newbie here:D
Comment