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:
The negative Line Spacing value is what is causing the issue 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.
Related
I'm running into an issue with GUI.Label in Unity3D. If I display some text on the screen and display that EXACT same string 1 pixel down and 1 to the right, it works correctly 99.9% of the time:
var old=GUI.color;
var shadow=rec;
shadow.x++; shadow.y++;
GUI.color=Color.black;
GUI.Label(shadow, txt, style);
GUI.color=old;
GUI.Label(rec, txt, style);
I've had this same code for years but I just recently discovered that a particular string will wrap text in the wrong place on the shadow text, even though they both have the same width in their rect's and same style. What's even more strange is it won't do this every frame. The text appears when I hover over something with my mouse and moving the mouse slightly will cause the shadow string to go back & forth, wrapping two different ways causing the shadow text to not coincide with the normal colored text.
Not an edge-of-screen issue either. I'm using 2020.2.1f1.
Thanks in advance!
Please note that I have already posted this question # mathworks.com but did not get any answer.
Let me try to explain a slight problem that I am facing.
In this figure, you can see that I have font “Monospaced” with font size 14. The right-hand text limit is place at 75th column. As you can see from the code, the line terminates at 75th position and then goes to the next line.
Now, if I change the font to say, “Comic Sans”, keeping the same font, the ‘right-hand text’ limiting line moves to a new position. But strangely, the text terminates not at the position where the line is shown, but in the same place where initially the ‘right-hand text limit’ was there.
I checked it for other fonts also, but still the problem persists. Any idea of what is happening?
Using Matlab R2021b.
Thanks in advance.
I'm working on a mind map editor in which the user can draw boxes and write text in them. However, the TMPro input fields I'm using in those boxes have extra-wide caret when I type in them, and changing the fonts didn't solve the problem. Here are some images of the issue:
The caret is so wide that it can push the text inside out of the box:
I tried to lower the caret width in my script, but it's an int and has already been set to 1. Can you give me some possible reasons as to why this is happening?
I solved that problem by multiplying width+height of my inputfield by 100 and dividing its scale by 100.
Don't forget to increase the font size significantly.
I'm trying to learn Auto Layout and playing around with various view combinations. I have various views containing other views, but the one I'm having trouble with is one that contains a label and a text field. They are set up like this:
There are several constraints set up on these, such as center Y alignment between the label, text field, and parent view, 0 leading edge for the label, and a hard coded value (12, but irrelevant) for the trailing edge of the text field. I had initially had it as a 0 trailing edge, aligning it with the parent container. However, the right edge of the text field seems to be cutting off and I have no idea why... I Started increasing the distance, thinking that may be there's a margin issue, but nothing seems to help!
Would love any input.
I have several items that I want to line up. The Width and Height of all fields match. Usually I just use the Align, but it's making it worse. My out of line field which is slighly lower, moves way up, way out of line (with align tops)
So I tried using the Size and Position to set it manually. Several objects have a Y of 0.056, but my last one has 0.061. I change the last one to 0.056 and save it. It doesn't appear to be different, and when I look at it again, it's still 0.061. (When I used align, it went up to 0.028!)
I do NOT have Snap to Grid set (my grid size is 0.083). (Nor does turning on Snap to Grid make them align.) The fields have exactly the same formatting. But unless I can magically make them align by hand, they refuse to align. Why?
You've already done a lot of the regular troubleshooting steps. One more ting that I sometimes do is to select all the fields I want to align, then use the arrow keys and move them up into the section above and then back down into their original section. That usually puts them all into the 0 position. If it dosn't work with all of them selected, try each one separately.