Due to the null reference error 7:20 my unity play mode is stuck in paused mode
error is prompted on the lie stating - if (waypoint.IsPlaceable)
COORDINATE LABELER
[SerializeField] Color defaultColor = Color.white;
[SerializeField] Color blockedColor = Color.grey;
TextMeshPro label;
Vector2Int coordinates = new Vector2Int();
Waypoint waypoint;
void Awake()
{
label = GetComponent<TextMeshPro>();
DisplayCoordinates();
}
void Update()
{
if (!Application.isPlaying)
{
DisplayCoordinates();
UpdateObjectName();
}
ColorCordinate();
}
void ColorCordinate()
{
if (waypoint.IsPlaceable)
{
label.color = defaultColor;
}
else
{
label.color = blockedColor;
}
}
void DisplayCoordinates()
{
coordinates.x = Mathf.RoundToInt(transform.parent.position.x / UnityEditor.EditorSnapSettings.move.x);
coordinates.y = Mathf.RoundToInt(transform.parent.position.z / UnityEditor.EditorSnapSettings.move.x);
label.text = coordinates.x + "," + coordinates.y;
}
void UpdateObjectName()
{
transform.parent.name = coordinates.ToString();
}