Search Unity

Interactive Text

Discussion in 'UGUI & TextMesh Pro' started by riot9, Sep 23, 2014.

  1. riot9

    riot9

    Joined:
    May 6, 2014
    Posts:
    35
    Hi everyone,

    I started a text based adventure a while back, but realized that a lot of what I wanted to do would be extremely hard with the previous GUI system, and opted to wait for the new UI. Now that it's here my job is going to be a lot easier, but there's still one feature I wanted to add that I can't seem to find a way to implement.

    What I want is specific words to be interactive. For example, you could see something like "against the wall is a well worn workbench, covered with faded papers and tools." The words "workbench", and "tools" could be in different colors, indicating that they can tap those words to read more, or interact with them. The colors look easy with the new UI, but the interactivity looks tricky, as the 4.6 manual specifically says text components are non-interactive.

    If markup could also assign events to fire that'd be ideal, but it doesn't look like that's possible.

    I guess I could use a button for the entire paragraph, but that means I could only have one word per paragraph. I think it'd also lead to a confusing experience and a lot of accidental presses as people scroll through the text.

    If I could somehow find the location of a word in my text and perfectly align an invisible button that might work too, but I don't know how to get the location of a word.

    Are there any other creative solutions you guys can think of?

    Thanks in advance for any help.
     
  2. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
  3. riot9

    riot9

    Joined:
    May 6, 2014
    Posts:
    35
    Wow, this is awesome Breyer! Thank you so much for your help. I'll give this a try and let you know if I have any follow-up questions.
     
  4. riot9

    riot9

    Joined:
    May 6, 2014
    Posts:
    35
    Hey Breyer,

    Sorry for the late response, but I just barely got around to testing this out. It works perfectly for me when I'm in the editor, but when I deploy it to Windows, Windows 8, or Windows Phone 8 the events don't seem to be firing.

    So in the editor the pointerenter and pointerexit triggers that go to Image work perfectly. I can even switch that to a pointerclick and it works how I wanted. As soon as I deploy to Windows Phone 8 I can't get anything to fire the events. When I deploy as a x86 .exe the pointerenter/exit events won't fire, though all other functions of the lighting example work as expected (sliders and tabs). pointerclick doesn't work either.

    I'm using beta 17. Any ideas? Am I doing something wrong somewhere?

    Thanks in advance!
     
  5. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    Update to 20 beta and see what happen. This sound like a bug with unity because for firing event i use override israycastvalid only which is general solution and should work with everything
     
  6. riot9

    riot9

    Joined:
    May 6, 2014
    Posts:
    35
    Thanks for the suggestion, but it looks like beta 20 has the same problem. I just tried all three scenarios, this time without modifying anything at all (leaving it with the two pointerenter/pointerexit rather than changing it to a click). I have an android tablet around somewhere I can try it on too, but I suspect it will have the same result.

    Does it work just fine for you when you build the project? If so there has to be something wrong on my end.

    Maybe there's something I'm doing wrong in installation? I downloaded the 20b ui example project, opened it up, deleted lighting scene, then imported yours, that's all I should have to do, right? It still works perfectly when I run it in the editor though...
     
    Last edited: Oct 7, 2014
  7. riot9

    riot9

    Joined:
    May 6, 2014
    Posts:
    35
    I built and deployed to android with the same results. Any thoughts?
     
  8. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    Sorry for late answer but i was busy and havent time to test and bug fix. Fortunately i found bug today and fix them. Download attached file and simply completely delete old version (except editor files). Should work now.
     

    Attached Files:

  9. riot9

    riot9

    Joined:
    May 6, 2014
    Posts:
    35
    It totally worked! You're a rock star Breyer, thanks so much for your help. :)
     
  10. yudixiaok

    yudixiaok

    Joined:
    Aug 29, 2014
    Posts:
    17

    Hey Breyer,Does It support multi-hyperLink ?