Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

TextMesh Pro TextMeshPro issues with input field

Discussion in 'Unity UI & TextMesh Pro' started by Micito, Jun 5, 2018.

  1. Micito

    Micito

    Joined:
    Dec 5, 2014
    Posts:
    7
    Hi everyone,

    First of all, let me say that text mesh pro is a great asset, it makes working with text in unity a lot simpler and easier. Having said that we have encountered some issues with input fields and we were wondering is there a way to overcome them.

    Issue #1: Inner caret position (string position) of input field is positioned after all tags

    InputField, in which RichTextEditing is disabled, positions caret in string after all tags which causes entered
    text to be of the following style, instead of previous.

    Consider following text in TMP input field:
    "ThisIsExampleText"

    If you position caret in front of 'E' character of "Example" and you start typing, you would expect the font NOT to be bold, but in TMP input fields font will be bold. Same goes as if you position in front of 'T' of "Text", user expects new text to be bold, but it is actually regular.
    As far as I can say, this happens because of input field's inner caret (stringPosition) being positioned after all tags, instead of before.

    Example:

    1.Consider following text in input field
    2.Position in front of the red text and start typing
    upload_2018-6-5_11-36-27.png

    Is there a way to remedy this?

    Issue #2: Selection in TMP InputField is not working correctly when it is rotated

    If you create input field, and enable it to be multiline, add long text to it and rotate it (~45 degrees), selection will not work correctly. Also RectMask2D is not working as well.

    upload_2018-6-5_11-21-27.png

    Issue #3: Indented lines will not get "unindented" once they are merged with previous line

    When user positions in front of second line (which is indented by 20px with indent tag), and presses backspace, that line is merged with previous line. But the indentation tag remains, and it is positioned over existing text.

    upload_2018-6-5_11-51-5.png

    Is there way to remove indentation tag?

    Issue #4: Sprite tag can be deleted even though RichTextEditing is disabled

    If sprite is added in input field, and user positions after it, he is able to start deleting tag by pressing backspace, even though RichTextEditing is disabled.

    upload_2018-6-5_11-56-17.png

    Is it possible to at least make it so that whole sprite is deleted? Or is it possible to make it unable to be deleted?


    I have created a demo project on this issues. You can download it here:
    https://drive.google.com/open?id=16F4ajDwpk_2S5AuEkyxV0gJAzl5eCX6_

    Thank you in advance
     
    Last edited: Jun 8, 2018
    royvaneijndhoven likes this.
  2. royvaneijndhoven

    royvaneijndhoven

    Joined:
    Jun 1, 2017
    Posts:
    37
    I have submitted a bugreport for Issue #2 before, Unity's QA has been able to reproduce it in multiple Unity version including the 2018.2 version and it has resulted in a IssueTracker entry. Sadly they have not been able to give me an ETA on when we can expect a fix. You can vote on the Issue here: https://issuetracker.unity3d.com/is...extmesh-pro-inputfield-is-working-incorrectly (The issue does not mention that the RectMask2D breaks as well.)

    In our case the product we're producing heavily depends on the "Text Editor" functionality. The bugs above in combination with an earlier bug that we've found in UWP Builds (the main Platform we're targetting) with Touch devices connected (https://forum.unity.com/threads/tex...g-correctly-in-uwp-build.528566/#post-3484279) makes our product unreleasable in it's current state.

    @Stephan_B Could you have a look? Or can you give us a ETA?
     
    Last edited: Jun 6, 2018
  3. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    1,636
    I'll try taking a look at these tomorrow.

    I should be able to address item 1, 3, and 4 in a relative short term.

    Item 2 is a bigger issue. I should be able to address the selection part but the 2D RectMask doesn't support rotation so that will be a much harder issue to address.
     
    royvaneijndhoven likes this.
  4. Micito

    Micito

    Joined:
    Dec 5, 2014
    Posts:
    7
    Hi Stephan,

    Thanks for a quick response, I have found 2 more issues, and have added them to the demo project.

    Link: https://drive.google.com/open?id=16F4ajDwpk_2S5AuEkyxV0gJAzl5eCX6_

    Issue #5: Input fields' text remain visible when input field is inside RectMask2D

    upload_2018-6-8_8-57-55.png

    This is ScrollView with RectMask2D (used only to move input field out of the view) with 2 input fields inside. The one on the left has text typed into it, the one on the right has Placeholder text displayed (it's empty). When scroll view is scrolled down, input fields go outside of rect mask, and while they are partly inside mask, everything works fine.
    upload_2018-6-8_9-1-31.png
    Ignore incorect masking, we are using rect mask instead of sprite mask here, and it's not really important.

    But once whole input field leaves RectMask2D, text suddenly becomes visible.
    upload_2018-6-8_9-4-31.png

    This might not have anything to do with TMP, but with masks.

    Issue #6: Getting preferred size doesn't include spaces at the end or start of text

    When we get preferred size of TMP's text it doesn't include empty space characters at the ends, so it is impossible to make input field that will correctly size to it's content.
    Example: Here we have input field (simplified for sake of displaying the issue). There is a script attached on it which sets size of input field to preferred size of text contents inside. When user types something, it increases automatically, but if the last characters are space (' ') characters, the width will not increase, instead text will start scrolling and as soon as non-empty character is added the width automatically increases (same for height).

    upload_2018-6-8_9-14-6.png
     

    Attached Files:

    Last edited: Jun 14, 2018
    royvaneijndhoven likes this.
  5. royvaneijndhoven

    royvaneijndhoven

    Joined:
    Jun 1, 2017
    Posts:
    37
    Are the issues in this thread being recognised? Do we need to create a bugreport or maybe seperate bugreports for the various issues? What is the next step to get these issues fixed as fast as possible?
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    1,636
    I am monitoring this thread which includes good feedback. I just need to find the time to get around to these items.
     
  7. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    198
    We are experiencing issue #5 too. When an TMP Input Field leaves the RectMask2D area the text suddenly appears. The input field graphic does not, just the TextMeshPro text.
     
  8. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    1,636
    See the following post for a solution to #5.
     
  9. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    198
    Yes thank you, that seems to fix my issue. Will you be doing a proper fix any time soon as it is a bit annoying having to go into debug to sort the issue out each time?
     
  10. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    1,636
    This fix will be included in the next release of the TMP UPM package.
     
    royvaneijndhoven and SketchWork like this.
  11. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    198
    Thanks buddy :)
     
  12. royvaneijndhoven

    royvaneijndhoven

    Joined:
    Jun 1, 2017
    Posts:
    37
    Nice! That's one down.
     
  13. royvaneijndhoven

    royvaneijndhoven

    Joined:
    Jun 1, 2017
    Posts:
    37
    I have just noticed that one of the issues talked about in this thread has been put on "By Design" and I'm assuming that means it'll not be fixed. So that makes me really curious why? @Stephan_B

    Could it be that the Bugreport was misinterpreted because it states "rotating" instead of "rotated"? I mean, the selection is completely wrong, that can't be by design.
     
    Last edited: Aug 8, 2018
  14. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    1,636
    The issue is related to the 2D Rect Mask which doesn't support rotation. So this is a design limitation of the 2D Rect Mask.

    Having said that, I certainly want to find some solution / alternative for TMP users but this has to be addressed by the UI team.

    With regards to rotated selection, I will take another look at that.

    P.S. Although I haven't had time to provide feedback on these items, they are on my list of stuff to address. Keep the feedback coming, it is greatly appreciated and feel free to poke / re-post to remind me as you have done today.
     
    royvaneijndhoven likes this.
  15. royvaneijndhoven

    royvaneijndhoven

    Joined:
    Jun 1, 2017
    Posts:
    37
    Thanks for the reply, I really appreciate the explanation.
     
  16. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    46
    Got another InputField issue that I think belongs to this list here. It feels like I must be doing something wrong, but for me text editing isn't possible once the text begins scrolling. When looking at the RectTransforms, it seems the InputField Input Caret RectTransform is moving upwards along with the ScrollView, causing me not to be able to select/edit text in the lower parts (and also not use the mouse wheel to scroll). What's going on here? Am I missing something?

    upload_2018-8-23_21-42-53.png
    (selected objecct is "TMP InputField (Content) Input Caret")
     
  17. Airship

    Airship

    Joined:
    Sep 10, 2011
    Posts:
    245
  18. Micito

    Micito

    Joined:
    Dec 5, 2014
    Posts:
    7
    I found one more issue. Validation is not working. Even the default example validator (TMP_DigitValidator) is not working.

    upload_2018-9-5_11-43-46.png

    The thing is, it actually goes through the code correctly, and the code returns valid character, but for some reason it's not added in the input field.

    Interestingly TMP_InputField.onValidateInput is working, so it's a workaround
     
  19. Airship

    Airship

    Joined:
    Sep 10, 2011
    Posts:
    245
    Yeah, I noticed that as well. I ended up getting by with just Regex validation which worked.
     
  20. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    1,636
    Those implementations were sort of experimental with regards to the TMP_DigitValidator types. See the following post on the TMP user forum which might prove useful.