TMP Dynamic text dictionary definition

Hello, I have a bunch of key words with a description of its meaning in JSON format that I want to display when a user mouse over the text on the NPC dialog in an attempt to reduce the need of exposition.

Such as for example

"Nargacuga":
{
    "Description": "A flying wyvern covered in pitch black fur.
It is extremely agile, especially on the ground, moving with explosive bursts of speed."
}

How do I create such system so that I do not have to manually place links on each text when I add/remove definitions?
How would you do it?

Thank you!

I just found out about <link=“”> in TextMeshPro. I probably can create a component that automatically parse over text and dynamically create link when text is initialized/changed, then create a tooltip UI that reads and display the link description.

I now need a OnTMPMouseOverLink(LinktInfo info) event handler. (Does this even exist? If not, why not?)

From surfing through solutions, the answer always points out to a “TextMeshPro Examples” asset, but I cannot find anything regarding that package.

How to operate and work with TMP programatically is always mysterious to me…
Where are the documented samples?

Take a look at example 12 and 12a included in the TMP Examples & Extras.

Example 12a has an event handler which you should be able to use / adapt for your needs.

Yeah, after trying to find the example package, apparently its within the “Packages/TMP” folder instead of it being in the package manager like all other Unity packages. I have a hard time finding it, and I finally found it. Thanks!

6549127--741085--upload_2020-11-21_23-55-2.png

1 Like