// Update is called once per frame void Update() { //turns the current score into a decimal between 0 and 1, which is the scale of the score bar GoalProgession = Mathf.Clamp(gameSession.GetScore() / gameSession.GetGoal(), 0, 1); gameObject.transform.localScale = new Vector3(1, GoalProgession, 0); if (GoalProgession == 1) { gameObject.GetComponentInChildren <Image>().color = completedColor; } //change the color of the bar when it's filled. }
// Update is called once per frame void Update() { ScoreDisplay.text = Mathf.Clamp(gameSession.GetScore(), 0, gameSession.GetGoal()).ToString();// display the current score and don't let it go over }