- Home /
Dynamically generate buttons from a single text component
I'd like to create multiple buttons (essentially links) based individual words from a single text component. The goal is to create a UI similar to how a wiki would look. However, I can't seem to access enough information to easily do this.
I have tried this solution but I cannot get it to work with the newest version of unity: http://forum.unity3d.com/threads/you-feel-that-your-text-is-too-simple-static-solution-here-text-action-pro-released.286214/
Is there internal information about the text component that i could utilize to make this happen? I need access to where certain words or mark up exists on screen so that I can build buttons from this information.
Thanks!
I assume the text is available as a string? It's just a matter of dividing the string into pieces (words) by checking for en empty space, and cutting that. StackOverFlow and other sites, including $$anonymous$$SDN, have loads of information about such string operations.
Hey Cherno,
I've thought about doing it this way, as it seemed feasible if arduous. However, I ran into this problem that may be a deal breaker for me:
http://answers.unity3d.com/questions/1072006/content-size-fitter-doesnt-update-rect-transform-i.html
I posted these as two separate questions in hope that I'll find an answer to the larger problem here, but have a backup plan if I can't find something reasonable.