TextMeshPro rich injection

Hey I’m not sure if this is a bug or no but i really want to talk about it,
i really recommend that unity set rich text off by default in TextMeshProUGUI
because it might be dangerous to leave it on
because a LOT of unity developers don’t know about this thing and i did injected rich in a lot of games made using unity,
and sometimes rich injection won’t just change the color or something like that

It can break something!

for example i found a game usees only 1 TMP field as an chat
so if i send a message, i think something like this happens
chat.text += $"\n{username}:{text}";
so i tried this <size=0>
and i broke the chat !!!

Learn more:

  • example.mp4
  • [TextMeshPro rich text](http://digitalnativestudios.com/textmeshpro/docs/rich-text/)

Thank you for your post and bringing this up to the attention of developers who might not have been mindful of this.

The Rich Text property is contained in the Extra Settings of the text object. This is something that all developers can control and disable if they deem it important for their project or how they are using the text component.

Clearly injecting rich text in an input field and using things like can result in strange text layout especially if the developer did not plan for users injecting rich text in their text.

I guess the message is that we (developers) need to be mindful of users potentially trying to exploit rich text in an input field but again it is up to the developer to control this property.

1 Like

Thank you for replying!
Are there some flaws/disadvantage in setting TMP rich disabled by default or finding another solution for that? because i guess its an additional thing. or maybe warn the developers in the docs about this thing, because when i read the docs i didn’t know that players can do that too after the game is built.

Rich text has been enabled by default on text components since 2014. This is something everyone takes for granted with respect to being able to use rich text.

Rich text has also been enabled by default on the Input Field since it was introduced. This is a feature that is pretty clearly exposed that any develop can disable as seen below.

7224100--868927--upload_2021-6-9_16-7-20.png

I think this is something that some developers might be overlooking and that should most certainly be reviewed / tested against prior to publishing their game / project.

Thanks for clarifying