Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Array of strings representing the lines in the Text component?

Discussion in 'UGUI & TextMesh Pro' started by therealedebarudo, Oct 8, 2015.

  1. therealedebarudo

    therealedebarudo

    Joined:
    Sep 26, 2014
    Posts:
    3
    Hey!

    I am in the middle of implementing Arabic support in one of our games. I use this free plugin in order to render the correct characters, but now I need to flip the order of the lines in multiline text boxes.

    Example:

    "This is how I want
    an Arabic text to
    show in the game"
    will render like

    "show in the game
    an Arabic text to
    This is how I want"

    which I think displays my problem well enough. My question is: Can I get an array of strings representing the lines in the Text component?

    My current workaround is to use the cachedTextGenerator that exists in the Text component to get information of the starting indices of the lines. With this I generate the string array and am able to flip the rows. This is a viable method, but not as low-energy as I would like to have.

    Cheers,
    Edvard from Sweden
     
  2. phil-Unity

    phil-Unity

    Unity UI Lead Developer Unity Technologies

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    The way you are doing it is the way i would have said it should be done. Sorry no easier method.
     
  3. therealedebarudo

    therealedebarudo

    Joined:
    Sep 26, 2014
    Posts:
    3
    Aw, chucks!

    Thanks for the rapid response anyway! :)