InputField caret with Canvas Scaler has wrong size and position.

When you use Scaler in Scale with Screen Size and use different than reference resolution caret has wrong size and position.
I guess problem is in GenerateCursor method as it doesn’t take Canvas().scaleFactor into consideration and changes height only if Text’s font is Best fit.

I just started investigating it, maybe someone has fix already? or there is a registered bug in progress?

Latest version in bitbucket does not have bug https://bitbucket.org/Unity-Technologies/ui/src/f28cad937efb/UnityEngine.UI/UI/Core/InputField.cs?at=5.0
But default version of InputField in Unity 5.1.0f1 has it…

I’m having the same issue. Will try the latest version in bitbucket, but it’d be lovely to get this fixed in an update.

Yeah, 5.1f3 still has this bug. Has anyone managed to find a workaround for this until Unity patches? Copying the InputField script and its dependencies into my project doesn’t seem to do anything, and replacing the UI system in 5.1 with the built 5.0.2 solution from Bitbucket results in all sorts of UI text fubar.

I have this error as well. I filled a bug but could not reproduce with a fresh new project. Anyone has?

EDIT: I managed to reproduce the problem and I’ve submitted a repro/bug.

Glad you found it, Thrawn. How did you reproduce it? I build an empty project and found that new InputFields worked fine, but all my old ones were borked, even if they looked the same in the inspector. I had almost resigned myself to going through and recreating all of my old fields.

Honestly don’t know exactly how. I created an input field exactly with the same configuration and parents like my other project and it worked well! Then I converted it to a prefab, changed font from Arial back and forth, and after one or two reloads, the issue started to occur as well.

1 Like

That’s odd, it happens to me every single time I create an InputField as long as I’ve put the Canvas Scaler to scale with screen size. Maybe the problem varies depending on the version of Unity?

Whenever the InputField’s text size is changed from the default, the caret and highlight color are in the wrong position.

The same issue after updating to 5.1.1f1

Still an issue in 5.1.2. :frowning: Where’s the issue tracker link for the reported bug so we can pile on? It probably ought to be re-reported anyway. I’ve done so on my end.

yeah… I didn’t find any existing issue about it. Need to create new one.

This was a lovely issue during the indiesvsgamers gamejam. Had to rethink the UI to accomodate for font size 14. Ridiculous.

I got this response to my bug report:

While I was hoping for a fix in a patch release, since the issue does horribly break a lot of game UI, at least we can expect a solution by the “next major version,” which I presume to be 5.2 on September 8.

Isn’t a major version usually the first number? http://semver.org/ By that standard the next major version would be Unity 6.

But it will indeed probably be Unity 5.2 considering UI improvement is one of the 5.2 beta features.

So what to do now? That carets are awful. Now it is 5.1.2 and nothing changed

We’ve been assured it will be fixed in 5.2. We need to wait for September 8.

glade is not so far…

correct the issue should be fixed in 5.2 reason it’s not a patch release is that we changed a bunch of stuff in text generation to make the caret positioning calculation more accurate. This sort of major change shouldn’t be done in just a patch.

Well, this may be too late of a post, but i managed to find a work around by

  1. Set the pivot of text field to 0,0
  2. Set Text to best fit and give it a same size for both min and max value
  3. Line Spacing to 0
  4. Alignment to top

You will find the text will float above the text box, Sizing the height of the text box appropriately for the caret to match in middle of the text.

Cheer,

sorry if this solution doesnt work for u it does work for me thr …