[Unity3D] Manage links with TextMeshPro

In Unity3D, you can use TextMeshPro or TextMeshProUGUI with embedded links. For example, your text can be:

TextMeshPro Text component with a link

But this is not enough to get it open on click. You also need to handle the click and execute the action you want, based on the link ID (here the link ID is the URL). To do that, just attach this script to the same object of your TextMeshPro or TextMeshProUGUI component.

This will open a simple URL in the device default browser. If you want to execute other actions within the app itself, just remove the OpenURL call and put the code you want.

Source 1, source 2

About Nicolas Form

I'm Nicolas Form, multi-skill programmer, aesthete and joyful French guy. On this blog I share my tips and tutorials about programming and IT in general. I am freelance, so you can also contact me about a website, an Android app or any other software you need. Check my portfolio and drop me a line!
This entry was posted in Unity3D. Bookmark the permalink.

4 Responses to "[Unity3D] Manage links with TextMeshPro"

Leave a Reply

Your email address will not be published. Required fields are marked *


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.

[Unity3D] Manage links with TextMeshPro

by Nicolas Form time to read: 1 min
4