- Home /
Inserting inline buttons/links into text in Unity UI.
Hey everyone,
I need a solution for the following problem. I have a game which outputs entries into a log which concern people and buildings within the game. I want each object (person, building, etc.) to have a link or a button/icon next to them INLINE which a user can click on to open an inspector window about that person, building etc.
I've looked around and I can't find many questions even about this, but it seems like something people might want to do somewhat commonly.
Any thoughts?
Thanks very much
There is no UI component that is capable of doing this. There are two ways I can think of doing this: - you write a little parser that reads your hyperlinks. When filling up a Text component you have access to information about the text like its generated mesh etc. from it's TextGenerator. You could then thy finding a way to measure and locate your hyperlink texts. Since Text can be interactable, you could read the clicklocation and if it's a hyperlink area, react - You could try splitting the text across multiple lines switching between Text with and without interractability.
That's what I can come up with
Thanks for the reply, I had mostly considered your second option but it seemed like a big amount of work - Can you elaborate a bit on your first option?
Your answer
Follow this Question
Related Questions
UI Relative to screen size 1 Answer
How to overlap 2 or more UI Elements 1 Answer
Graphic problem with UI Text 2 Answers
New UI: change text 2 Answers