GetComponent<TextMeshPro>().text ?

Hello, I was wondering how I could edit the text in a TextMeshProTextUI element since for me “TMP_Text”,“TextMeshProUGUI”, “TextMeshPro”, and “TMPro.TextMeshProUGUI” doesn’t work.
Example code:
version = GameObject.Find("version").GetComponent<TMP_Text>().text;
Thanks.

In your script add a public field and then in the Inspector, assign the text object whose text property you want to change.

public TMP_Text TextComponent;

Then in your code, simply do TextComponent.text = “Some text”;

Somehow, I’m getting an error. It cannot find the type nor can it find something to import.7678648--959674--upload_2021-11-22_20-18-52.png

You need to add

using TMPro;

I’m getting7679872--959842--upload_2021-11-23_7-47-50.png.

Nevermind, had to add attribute.