Search Unity

[TMP Input Field] Caret, Text component unappropriate behaviour

Discussion in 'UGUI & TextMesh Pro' started by darkcheg, May 29, 2019.

  1. darkcheg

    darkcheg

    Joined:
    Dec 4, 2014
    Posts:
    1
    Easy to reproduce even on an empty project.

    1. Create TMP_InputField
    2. Set Text alignment to Center
    3. Enter the playmode
    4. Type something to overflow input field typing area (30 W characters for example)
    5. Press Ctrl+A to select all the text
    6. Press delete
    7. Observe Text RectTransform Left and Right positions are wrong

    upload_2019-5-29_15-17-48.png

    TMP version: 1.3.0
    Unity version: 2018.3.14f1
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    This will be fixed in the next release of TMP as I was already aware / working on this :)

     
    Last edited: May 29, 2019
    pdyatlov likes this.
  3. ASGS_DumbFox

    ASGS_DumbFox

    Joined:
    Sep 23, 2017
    Posts:
    22
    Hey @Stephan_B

    I just ran into a similar issue and I'm thankful I was eventually able to come across the OP's post as it helped me debug the issue.

    We had text with no mask and were using overflow to allow users to add as much text to that line as they need but the local text was off-centered while the server loaded text was centered. Our users are moving text on world space "white boards" and need to be able to have their text in the right orientation for themselves and others.

    As of TMP 2.1.1 I'm still seeing this issue with the Text Component of the TMP Input field aligning to the caret position regardless of whether the text is Left, Center, or Right justified.

    The resolution I've come to was to manually reset the Rect Transform of the Text Component in the Input Field's OnEndEdit call.

    upload_2020-10-15_11-34-22.png

    Just for my own curiosity (since I've been banging my head against the wall for way too long on this issue) is there any eta on a fix?
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    How does the text / alignment behave when you leave the Mask in place?

    Can you provide me with a sample scene or submit a bug report with project to allow me to take a closer look?