#TextMeshProUGUI error please help

1 messages · Page 1 of 1 (latest)

timber zodiac
#

Hi my code is throwing an error with the textmesh. I can't call on it at all in my script and don't really know what's causing it?

Script Timer:

using TMPro;
using UnityEngine;

public class TimerText : MonoBehaviour
{

    public TextMeshProUGUI timerText;

    private float elapseTime;

    // Update is called once per frame
    void Update()
    {
        elapseTime += Time.deltaTime;
        int min = Mathf.FloorToInt(elapseTime/60);
        int sec = Mathf.FloorToInt(elapseTime % 60);

        timerText.text = string.Format("{0:00}:{1:00}",min,sec);
    }
}
small minnow
#

just fyi the newer versions of Unity its no longer in TMPro but in UI package

#

but it should still suggest it at least in VS

timber zodiac
#

@small minnow This is weird I'm getting this error but now I am able to drag the item into the field

small minnow
timber zodiac
small minnow
# timber zodiac

btw instead of typing that long type you can use TMP_Text its the parent class that also supports the 3D TextMeshPro aside from UI

timber zodiac
#

Btw im also getting errors like this in my package manager

vast cypress
timber zodiac
#

6000.3.0b4

vast cypress
#

@timber zodiac Do you see something like this in unity hub next to the project in the list (when you hover the ⚠️)?