Text Mesh Pro issues

I am unable to add the namespace to my code to make it recognize my text. Rick adds the following.

using TMPro;
[SerializeField] TextMeshProUGUI guessText;

The issue is, I am using Unity 2020. My Text Mesh Pro says Text Mesh Pro - Text (UI). How do I declare this in namespace and as a serialized field?

I am on 2020.1.3 and the TMPro namespace works fine for me as shown…


using UnityEngine;
using TMPro;

public class textchanger : MonoBehaviour
{

    [SerializeField] TextMeshProUGUI mytext;
    int counter;
    
    void Update()
    {
        if (Input.GetMouseButtonDown(0)) {
            counter++;
            mytext.text = "You clicked "+ (counter.ToString()) + " times.";
        }
    }
}


Thanks! That really helped.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms