Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Stylesheet tags to parse Anim tags #28

Open
edwardrowe opened this issue May 12, 2019 · 2 comments
Open

Allow Stylesheet tags to parse Anim tags #28

edwardrowe opened this issue May 12, 2019 · 2 comments

Comments

@edwardrowe
Copy link

It would be great if I could use "Anim=Fullshake" tags as part of the Style attributes in a TextMeshPro style sheet.

@edwardrowe
Copy link
Author

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 tags in it. This works, unless you put other tags in there. 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.

@edwardrowe
Copy link
Author

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 "" in the text, if it was contained in the style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant