Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

TMPro Input Caret too large

Discussion in 'UGUI & TextMesh Pro' started by sincerelysleepy, Apr 26, 2021.

  1. sincerelysleepy

    sincerelysleepy

    Joined:
    Jan 15, 2019
    Posts:
    34
    Hey there. I have a TMPro Input setup for world space. It seems that the smallest width I can put it to is 1, which seems extremely large. Is that because it's world space? I kind of need my input to be in world space because I am moving the text with an an game object. I have all of the scales for the parent and children set to 1, but can't seem to get a smaller size.


     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Did you manually change the scale of any of the child objects of the TMP Input Field? If so, I would suggest keep the scale of those child objects as is and adjusting the scale of the TMP Input Field itself.

    Let me know if that is a workable solution for you.
     
  3. sincerelysleepy

    sincerelysleepy

    Joined:
    Jan 15, 2019
    Posts:
    34
    I have not changed the scale of any of them. I just verified that the Input field, the text field and the placeholder are all at a scale of 1.
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Can you share the settings of the various parent objects of the Input Field? More specifically, Canvas settings if it is in screen space or world space. Anything that can affect the scaling of those child objects.
     
  5. sincerelysleepy

    sincerelysleepy

    Joined:
    Jan 15, 2019
    Posts:
    34
    Sure thing. First. It's a world space canvas. The tombstone comes up from the ground in the beginning so I'd like the text to stay with the parent.

    The top element is a canvas


    The Second sibling "Tombstone" is just an image and acts as a container


    The next item down is just a sibiling, named "Text" in the hierarchy you see there. The third item "Message" is the actual input element (Here is the full inspector for that object:



    The first child "Text" under message is the actual input field:


    Finally, the placeholder:


    Let me know if you need more info! Thank you
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Thank you for providing those images.

    I have a feeling that modifying the structure of the Input Field to remove the Text Area may be contributing to this behavior. The default structure of the input field is as follows:

    upload_2021-4-26_13-36-34.png

    See if keeping the structure of the TMP Input Field structure intact behaves correctly.

    If that doesn't resolve the issue, then could you please provide me with a repro project / scene that would enable me to reproduce this so I can take a closer look.
     
  7. sincerelysleepy

    sincerelysleepy

    Joined:
    Jan 15, 2019
    Posts:
    34
    That didn't fix the issue. I created an entirely new project in Unity 2019.4.17f1, added a world space canvas, dropped an input field on to the screen, added an event system and hit play and the Caret is still massive. Where can I provide you with a sample project?
     
  8. sincerelysleepy

    sincerelysleepy

    Joined:
    Jan 15, 2019
    Posts:
    34
    Here is a link to the sample project on my Google drive. Let me know if it works. Thank you.
     
  9. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Thank you for provide the project.

    Looks like the issue comes from the fact that you have a Canvas in World Space but using a Camera that is Orthographic and not sized to reflect the Game view resolution.

    Is there a reason you are using a Camera that is Orthographic of size = 5?
     
  10. sincerelysleepy

    sincerelysleepy

    Joined:
    Jan 15, 2019
    Posts:
    34
    Well, we've been creating our 2D art with cam size in mind and we've just been using 5 throughout the project to be consistent. The reason we are using world space is because I wanted a camera shake effect for when the tombstone rises and the UI is not effected by camera shakes. Any suggestions?
     
  11. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Looks like you also manually adjusted the point size of the child text objects to 2 which is super small and can lead to potential issues with things like text auto-size, etc. Ie. it is always best to use sort of normal point size values and not super small values.

    Here is a potential alternative.

    Increase the Width and Height of the Input Field to (68 x 40). Decrease the scale of the TMP Input field to (0.25, 0.25, 0.25), change the point size to 10 which like all these other values is 4X larger. Then lastly change the Pixels per Unit Multiplier on the image to 0.25 as seen below.

    The above scale and value tweaks might not be exactly to your liking but conceptually would enable you to further tweaks these values to get exactly what you want.

    upload_2021-4-26_16-13-34.png

    This would produce the following results without having to touch anything else like camera settings.

    upload_2021-4-26_16-14-16.png
     
    Last edited: Apr 27, 2021
    Eristen likes this.
  12. sincerelysleepy

    sincerelysleepy

    Joined:
    Jan 15, 2019
    Posts:
    34
    Okay, thank you!
     
  13. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    See my previously edited post :)
     
  14. sincerelysleepy

    sincerelysleepy

    Joined:
    Jan 15, 2019
    Posts:
    34
    Ah! this works! :) I'm assuming this is just a workaround and this is an actual bug? I'm just a little confused as to why I have to do this. It's not a huge deal because I won't usually need an input field on a world object, I am just curious if this is how it's supposed to behave or not.
     
  15. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    It is certainly a behavior that I need to revise in the future to avoid other users running into this.
     
    sincerelysleepy likes this.
  16. sincerelysleepy

    sincerelysleepy

    Joined:
    Jan 15, 2019
    Posts:
    34
    Well thanks again! I appreciate your help. Cheers!
     
  17. FredricMourath

    FredricMourath

    Joined:
    Apr 3, 2020
    Posts:
    3
    They never revised it ^^ Shocker.
     
    rstrong likes this.