![]() This will unpack files into the folder Third Party Support/TextMesh Pro.Īn example scene is in Third Party Support/TextMesh Pro/Example/Feature Demo with TextMesh Pro. To add support for TextMesh Pro, import the package Third Party Support/TextMesh Pro Support. I've only tested this on the Canvas text object and not the world space one, but I believe it should work on either.This page describes how to set up the Dialogue System with TextMesh Pro. I've commented this in the code as well, but be aware of the injection attack ramifications of using Application.OpenURL. You can fill that function in with whatever you want. The onEnter events were changed to an onClick event, all of the text utilities for watching anything but links were removed, and the delegation was just changed to a single HandleLinkClick function call that gets executed when a link is clicked. But if someone finds themselves in this thread and confused by all of that, then here's a stripped-down version of the code from that example scene. That's not to take away anything from that scene 12a code - I think it's pretty sweet stuff. If you really just want to use the TextMeshPro link feature for opening up hyperlinks, you don't need to be able to add arbitrary delegates to each of these events. The 12a scene in the TextMeshPro examples was very helpful for me, but that code essentially sets up a full-featured callback system for all the various library functions found in TMP_TextUtilities.cs. The code below does use the event system, so you'll have to have everything set up properly for that, too (EventSystem in scene raycaster on the camera, raycast target checked on the TextMeshPro component, etc.). ![]() You do need distinct IDs, regardless if you use the same ID for each link, it will only go in the TMP_ collection once (I don't know which of the link texts would be in the table in this case, either). You could modify the code below to use the link ID instead of the link text if you wished, then you could write whatever text you wanted into the link and put the address in the ID instead. The text that's inside the link is the address that gets opened, so put any additional tags (color, etc.) on the outside of the link tag. Here's a component you can add alongside a TextMeshPro component that will allow you to run a function when text with a link tag gets clicked. Do you see a potential problem if you only have one link to show off? UNLESS my mouse moves to the second link, then going back to the first one fires off the event again. In the 12a example, my mouse over does debug log info about the link (NEAT!), however, it only happens once for mouse over, if I move the mouse away from the text and back again, it doesn't fire a second time UNLESS. How do you add clicking action on a link exactly? Is this needed for iOS/Android, since hover isn't really possible for us? I'm assuming that the parent doesn't *have* to have a canvas directly attached to it correct? Quick testing shows that it can still fire off the link events even if the TMP Text has a new empty gameObject between the canvas and the Text component. When I load up the scene, I notice that there is a canvas that has "Text Mesh Pro UGUI" object under it. Thank you for helping us out! So I do have some open questions if that's okay with you: You will see that TMP can return this link ID via an event when you mouse over said link. If you look at example 12a and the related scripts. A tag that would allow you to achieve something similar is the some text tag. Then the rest of your implementation isn't specific to TMP but on how to open a link in Unity via scripting. You could have several in your text, this simply means the same event callback would be called for all those links using the same ID.įocusing on understanding Example 12a and the script used to handle the event and registration for receiving those events. This is how you can internally on your end identify what should happen when this link is encountered. The ID in has to be unique for whatever you wish to implement for it. By functionality, I mean you could change the color of the text, change vertices, or in your case make it open a webpage which would make this tag behaves like. Once get this callback, you can implement whatever functionality desired for this ID. Click to expand.TextMesh Pro does not have an tag.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |