React to "<a href=..." clicks from UIElements.Label texts?

Unity supports the rich-text tag "<a href=...>" and will do the corresponding operating system action (usually open a web browser) when clicking on that label.

Can I register a handler that customizes the behavior for the label (or globally - similar to EditorGUI.hyperlinkClicked for console <link=...> messages)?

Edit: A bit of debugging leaves me with little hope. The call to Application.OpenURL comes from TextEventHandler.ATagOnPointerUp and comes from a simple PointerUp. It seems to be unconditionally and non-configurable :frowning:. So I guess there is no secret “RegisterEvent<HyperlinkClicked>” or something like that…? Anyone knows whether I can at least hijack parts of this system?

Check out this post: Interacting with subsections of text

Ah, thanks! So it DOES just work with <link> :slight_smile: .

In your example, the first “<link>” - label gets the style “link” assigned in uxml. Is that a built-in style? I can’t find it in the uss…

So I assume, I have to do my own <u> wrapping and coloring with the rich text tags, until you have implemented the mentioned “cutting the text apart and have different visual elements” implemented? fine-by-me.