- Home /
How do I color exactly half of a word in TMPro UI text?
Hello,
I have a text element in my UI that displays text dynamically with varying word lengths and that should be colored half black and half red. The order of colors needs to be adressable from a script.
I have tried applying an infinitely narrow gradient (so basically an instant transition) through TMPro, but this is applied per character and I don't think it is possible to change that to a per word/line basis.
I have also considered using two text fields that cut off at their border, but this would be a really janky solution and pretty difficult (not possible?) to scale correctly for different word lengths.
Thanks for your consideration, I'm at a bit of a loss for a more elegant solution.
Your answer
Follow this Question
Related Questions
Text Changes to Black 7 Answers
Modify individual letters in new Unity UI Text 1 Answer
Screen Space Overlay UI Text is Blurry 1 Answer
UI Text.color not assigning? 2 Answers
How to change color of text relative to current color? 1 Answer