Hey guys, how do I go abouts implementing a simple highscore system. this is my scoring based code
using UnityEngine;
using System.Collections;
public class Score : MonoBehaviour
{
public GUIText JewelsText;
public GUIText WinText;
private int Jewels;
void Start ()
{
Jewels = 0;
SetJewelsText();
WinText.text = "";
}
void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "Pickups")
{
other.gameObject.SetActive(false);
Jewels = Jewels + 1;
SetJewelsText();
}
}
void SetJewelsText()
{
JewelsText.text = "Jewels:" + Jewels.ToString();
if(Jewels >=2)
{
WinText.text = "You Collected all the jewels!";
}
}
}
I want it to so save the previous score but reset if its beaten next time round