Search Unity

Unity UI What is the best way to go about returning the word clicked, from a single UI text?

Discussion in 'UGUI & TextMesh Pro' started by joelybahh, May 16, 2018.

  1. joelybahh

    joelybahh

    Joined:
    Mar 18, 2015
    Posts:
    66
    The reason I am asking this is I have some voice to text implemented, and it returns the string for what was said quite reliably.
    However, If the user says a big sentence and realizes one word was misinterpreted, they currently have to start again and say that whole phrase over again, resulting in another chance of mis-interpretation.

    Ideally the user will click the word they see as misinterpreted, and just re-say that word.

    I have considered splitting the string by the space character, instantiating buttons with no background, and then placing/spacing them to be restructured back into a sentence of clickable text buttons, which sounds a bit messy.

    Things to consider:
    • This is on a worldspace canvas.
    • The UI interactions are triggered by the user pointing the vr controller at the panel.
    • The standard unity hover, click and unhover events are still called as normal, just on a worldspace panel with VR.

    Has anyone ever done anything like this in the past who can assist?

    Regards,
    Joel - InspaceXR
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,702
    Sorry no one replied to this yet. If you can switch to TextMesh Pro, you can check which word was clicked with a single function, as described in this video:


    This blog post has some code examples that might help, too: https://deltadreamgames.com/2018/01/