2D Toolkit Forum

2D Toolkit => Support => Topic started by: TwistedSage on December 09, 2014, 10:07:59 am

Title: Is it possible to detect sub-word inside textmesh on touch?
Post by: TwistedSage 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
Title: Re: Is it possible to detect sub-word inside textmesh on touch?
Post by: unikronsoftware 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...
Title: Re: Is it possible to detect sub-word inside textmesh on touch?
Post by: TwistedSage 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 :)