using UnityEngine;
using UnityEngine.UI;
public class score : MonoBehaviour {
public Transform player;
public Text scoreText;
// Update is called once per frame
void Update () {
scoreText.text = player.position.z.ToString();
}
}
using UnityEngine;
using UnityEngine.UI;
public class score : MonoBehaviour {
public Transform player;
public Text scoreText;
// Update is called once per frame
void Update () {
scoreText.text = player.position.z.ToString();
}
}
you are using TextMeshPro Text, so your code should be
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class score : MonoBehaviour {
public Transform player;
public TMP_Text scoreText;
// Update is called once per frame
void Update () {
scoreText.text = player.position.z.ToString();
}