Search Unity

Flexible font-size?

Discussion in 'UIElements' started by MartinIsla, Dec 8, 2018.

  1. MartinIsla

    MartinIsla

    Joined:
    Sep 18, 2013
    Posts:
    64
    Hello!

    I'm working on a zooming in/out feature using the scroll wheel.
    Resizing the main container of the object works for most objects since they scale in relation to their parents. However, font size doesn't change size at all, which I guess makes sense. I'm thinking I could calculate the size in relation to the VisualElement's parent when scrolling, but is there any way to do it using USS?

    Thanks!
     
  2. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    294
    If you're using `someVisualElement.transform.scale`, everything inside the element should resize, including the text.
     
    MartinIsla likes this.
  3. MartinIsla

    MartinIsla

    Joined:
    Sep 18, 2013
    Posts:
    64
    Woaaah! That's actually much better than my solution! Thanks.