I can import TMPro to my ScoreBoard.cs file, however, when I try and create an attribute ‘scoreText’ of type TMP_Text, I get an error. Tried searching online for the solution but nothing. I thought it was something to do with the .csproj files for my Unity project but it isn’t. It’s as if the TMP_Text class doesn’t exist within the TMPro namespace.
Below is my code for the ScoreBoard.cs file:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class ScoreBoard : MonoBehaviour
{
int score;
TMP_Text scoreText;
private void Start() {
scoreText = GetComponent<TMP_Text>();
scoreText.text = "Start";
}
public void IncreaseScore(int amountToIncrease) {
score += amountToIncrease;
Debug.Log($"Score is now: {score}");
}
}
EDIT: I have tested the game and it works as intended, I just can seem to get rid of the highlighted error with VSCode