Search Unity

How to Set Input Field Font

Discussion in 'UGUI & TextMesh Pro' started by John-B, Feb 3, 2020.

  1. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I just realized, after setting up MANY input fields, that setting the font and size in the parent input field DOES NOT set the font/size in the text or placeholder text children. The children's font remains the default LiberationSans. Is this the way it's supposed to work? Is there any way to set the font without having to select each item and go down two levels to get to the text?

    Just checking some other apps that I recently updated, and this doesn't happen all the time. Some text has the correct font (parent-child match), but most do not.
     
  2. Antistone

    Antistone

    Joined:
    Feb 22, 2014
    Posts:
    2,836
    How exactly are you "setting the font and size in the parent input field"? AFAIK it does not have properties for those.
     
  3. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    In the attached screen capture, the parent input field is on the left, and the child text component is on the right. Looks like the parent is correctly linked to the child text component. The parent is set to HelveticaNeue and the child still set to the default LiberationSans. The text should be Helvetica 28 point. I didn't notice this at first because the two fonts look similar (to me).

    TMP Pro.jpg
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Changing the font asset on the parent TMP Input Field should change it on the child text component. I will double check this later today and provide feedback shortly thereafter.

    What version of Unity and TMP are you using btw?
     
  5. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Looks like TMP is 1.0.54 according to the PDF, Unity 2018.2.
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    That is an old legacy version where the reported behavior was addressed at some point on subsequent releases. The latest for Unity 2018.4 is version 1.5.0-preview.4.

    Is there a reason why you are still on 2018.2 instead of 2018.4?
     
  7. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    These are some older, mostly Javascript projects that I'm updating. 2018.2.2 is the last release that supports Javascript. I'm putting off converting these to C# till the next update (as long as possible).
     
  8. Bossaa88

    Bossaa88

    Joined:
    Oct 20, 2020
    Posts:
    1
    I have the same prob