Question by
foxtrotthegamer · Nov 20, 2018 at 09:27 PM ·
transformtext
Stop counting score when Game over : don't know how to do it...
I am creating a game using C# script and want to stop scoretext from counting when player's x position is larger than 5 or less than -5 (Game Over). Can someone tell me how to do it? Thanks.
Here is my code. I don't know how to continue :(
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class Score : MonoBehaviour
{
public Transform Player;
public TextMeshProUGUI scoreText;
// Update is called once per frame
void Update()
{
scoreText.text = Player.position.z.ToString("0");
}
}
Comment