Open edwardrowe opened 5 years ago
This looks like it will be difficult.
I tried applying the text (before parsing for tags) to the component, then using TMPro's GetParsedText()
function to get the text with the GetParsedTags
will return the text with no tags (except custom ones). Which means it essentially will strip the tags.
I can't think of a good workaround.
Another way would be to lookup the styles manually and parse the tags for Anim or other custom tags. But currently the Styles aren't exposed. See https://forum.unity.com/threads/is-there-a-way-to-get-a-list-of-all-the-styles-defined-in-the-stylesheet.607351/#post-4062088.
Made a bit of progress parsing styles and substituting them with their opening and closing definitions. But it fell over when I tried to look up the Styles based on a "hashCode" for the tag's parameter (Ex: style=Shout tried to look up Shout.GetHashCode()). But this must not be how TMPro generates the hashes, so it can't find it.
Until there's a legit API to lookup and retrieve styles this is going to be difficult. Even when there is, we'd need to substitute in the tags since we need to parse OUT the Unity tags and keep the others. Otherwise TMPro will end up putting in a Unity tag after they've been removed by the TextTyper. So you'll see "
It would be great if I could use "Anim=Fullshake" tags as part of the Style attributes in a TextMeshPro style sheet.