I would like to show naturally wrapped text with interactable components in a text UI box.
For example, I want to display ‘There are apples and oranges in a basket on the table. They glisten in unison in a pool of moonlight.’ If the players click on the ‘apples’ or the ‘oranges’ word, an event is triggered. If the player click other words, nothing happen.
With TextMesh Pro (which is now for free and will be included in the next version of Unity) you can create links inline in a text AFAIK.
Not sure if you can connect custom logic to such a link or something similar.
However, with the normal Text component of Unity UI it is not possible.
thank you, hosnkobf … that’s depressing. Link is not enough for my design.
I’m planning a novel gamebook to follow up on my hit game, Hyper Rift. I want the player to be able to … say … drag the ‘knife’ on the table to the ‘apple’ in the basket and trigger an event. I guess none of that would be possible, even with text mesh pro.
TextMesh Pro does provide for the ability to detect interactions with characters, words, lines and links. The example scene “Text Interactions” is an example of how events can be triggered and handled when the cursor is over a character, word or link.
Just take a look at the Event Handler and script used in that example scene which provides a good example of how you could implement your own custom logic based on interactions with any of those text elements.