TextMeshPro, Text Inputs

I have one canvas attached to a child object. I have two texts which are words. I have one Text that is actually a number for tracking a velocity and one slider tracking fuel level.

My problem is whenever I use “AtvVelo1 = FindObjectOfType();” It always grabs one of the text inputs that are words.

The question is how do you tell unity which of the text inputs you want to access? Even if I put the other one first, it still grabs the wrong one and if I turn off the one I don’t want it grabs none of them

Do I need another canvas or is there a way to use a find with tag on TextMeshProUGUI?

AtvVelo1 = FindObjectOfType();
string temp1 = (Velocity).ToString(“0”);
AtvVelo1.SetText(temp1);

Always the same answer for Unity, ALWAYS… it’s the most common workflow and every tutorial or example project uses it: you make and assign the fields:

public TextMeshProUGUI VelocityReadout;
public TextMeshProUGUI FuelReadout;

Love it, embrace it, your Unity experience will be FAR smoother than trying to Find stuff on the fly.

Save the tricky-tricky “Find on the fly” stuff for when you have a lot of time in Unity and understand why what you did above isn’t working.

Thank you so much, that worked instantly. It is what I had but I was recalling the TextMeshProGUI again without the reference so it always reverted to the other text.