2

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:

1
  • Can you show us a screenshot of the misbehaving textbox, with its properties at runtime? Commented Feb 26, 2017 at 23:36

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.