How can I change the text from within a script? (I'm having the component on an empty game object, and not on a canvas)
You need using TMPro; at the beginning.
To change the text, use GetComponent<TextMeshProUGUI>() to get the component and then the SetText() method.
Do you know if you can change the text from an animation, I've had some issues with that, wherever I change it on the animation time line it applies it to the entire timeline.
Not sure if I'm understanding what you're saying. You can call methods from the timeline of an animation and change the text via script.
Thats how I thought it should work too, and does for almost all the fields I've tried. For example, I'm changing the gradient, the size, the transparency, the position, etc... but if I try to change the text its like it takes effect outside of the timeline and just changes the text globally as if it had no idea I was editing the timeline.
[your gameobject].GetComponent <TextMeshProUGUI> ().text = [new text];
News, Help, Resources, and Conversation. A User Showcase of the Unity Game Engine.
Please refer to our Wiki before posting! And be sure to flair your post appropriately.
Unity Tutorial Modules
Unify Community Wiki
Getting Started Guide
50 Tips and Best Practices for Unity (2016 Edition)
Unity's Execution Order of Event Functions
Using Version Control with Unity3d (Mercurial)
Makin' Stuff Look Good
Halisavakis Shaders Archive
World of Zero
Board to Bits
The Big List Of Game Design
PS4 controller map for Unity3d
Colin's Bear Animation