I am trying to set the score of the game to zero every time the game is reset, I have no clue how to do this. I have two scripts that are for the score.
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class ScoreManager : MonoBehaviour
{
public static int score; // The player's score.
Text text; // Reference to the Text component.
void Awake ()
{
// Set up the reference.
text = GetComponent <Text> ();
}
void Update ()
{
// Set the displayed text to be the word "Score" followed by the score value.
text.text = "Score: " + score;
}
}
using UnityEngine;
using System.Collections;
public class Score : MonoBehaviour {
public int scoreValue = 1;
// Update is called once per frame
void OnMouseDown () {
ScoreManager.score += scoreValue;
}
}
The first one is to display the score. The second one adds points when the object is touched. After 30 seconds the game takes you to a menu and displays the score. Then there is a reset button that when is touched, I want it to reset the score. How do I do this.