So I have the code the exact same as it is in the lesson and I keep getting this NullReferenceException. I Serialized the label field to check and the code just isn’t putting anything in there which I’m guessing is the problem. Has TMP changed something since the lesson came out or whats exactly going on here?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
[ExecuteAlways]
public class CoordinateLabeler : MonoBehaviour
{
[SerializeField] TextMeshPro label;
void Awake()
{
label = GetComponent<TextMeshPro>();
}
void Update()
{
if(!Application.isPlaying){
DisplayCoordinates();
}
}
void DisplayCoordinates(){
label.text = "--,--";
}
}