unity-game-enginetextjtextcomponent

Text component displaying lines in reverse order


Alright, I do not know how to fix this and only ran into this problem after trying to put in some longer text on a UI Text component. I have tried both pasting a value into its Text attribute through the Unity editor, and setting its value programmatically like this:

t.GetComponent<Text> ().text = "This is where meat, fish, and [...] (long text)"

Because Horizontal wrap is on, the text wraps when it reaches the edge of the available space.

However, the text displays backwards. Meaning, the start of the paragraph is at the bottom, and bottom at the top. Taking off wrap fixes this, but then the font size has to be really small (or it won't all be visible), and it can't form a normal paragraph because it has to... you know... wrap.

Is this a bug in Unity?

This is what happens - as you can see, it is displayed backwards:


Solution

  • The negative Line Spacing value is what is causing the issue here:

    enter image description here

    When the value of this field is less than 0, the lines will actually be arranged backwards, leading to the behaviour you're currently encountering. Just change the value to a positive number to have the text display correctly.