Float or int to TMP Text

Hi, I have a variable that can be a float or int and want to change my TextMesh Pro text to its value. How can I do that? Here’s what my script looks like. I tried to convert it into a string but that gives me an error. Please help!

using UnityEngine;
using TMPro;


public class MoneyCatch : MonoBehaviour {

    public float moneyValue;
    public TMP_Text moneyCounter;
    moneyCounter = moneyValue.ToString;
1 Like

The actual text is just one of many elements of the TMP_Text object/class.

moneyCounter.SetText(moneyValue.ToString();

should work.

14 Likes

It worked! Thank you so much for your help!