Hello Guest

Author Topic: Is it possible to detect sub-word inside textmesh on touch?  (Read 3235 times)

TwistedSage

  • Newbie
  • *
  • Posts: 15
    • View Profile
Is it possible to detect sub-word inside textmesh on touch?
« on: December 09, 2014, 10:07:59 am »
Well. Header says it all. I need to split a sentence in words and have each word be "touchable".
I could do it in code, dynamically creating textmesh'es, but I was wondering if there is an easy way to do this?

Thanks in advance

Odin

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Is it possible to detect sub-word inside textmesh on touch?
« Reply #1 on: December 09, 2014, 10:25:40 am »
No there isn't an easy way to do this. Having said that though, if you give each word a subtly different color (eg. 0xffffffff, 0xfeffffff, etc) then you can figure out which triangle you're touching, look at the vcolors and you'll know straight away which word you're touching. Or you could simply add some code to tell you where all the quads for the characters are...

TwistedSage

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Is it possible to detect sub-word inside textmesh on touch?
« Reply #2 on: December 10, 2014, 07:32:03 am »
I just split it up and added a TextMesh for each with a 2D box collider. That worked fine. But your suggestions are cool as well thanks :)