Search Unity

TextMesh Pro Get size of a text that overflows

Discussion in 'UGUI & TextMesh Pro' started by CorentinPB, May 3, 2020.

  1. CorentinPB

    CorentinPB

    Joined:
    Jul 14, 2017
    Posts:
    3
    Hello,

    I'm working of a project where I need to make an automatic horizontal scrolling text. To do that, i thought that the easiest way was to use a mask and to change the x position of my component back and forth using a Tween. But in order to do that, i need to get the size of the component that overflows, is there any way to get this ?

    By searching, i only found this kind of methods :
    Code (CSharp):
    1. GUI.skin.label.CalcSize
    Unfortunately this isn't precise and I would need the size of the entire text with the settings of the text (font size, margins, etc).

    Also an extra question, is there a way to know if a text is overflowing or not in a script ?

    Thank you,
    Corentin PB
     
  2. SLN

    SLN

    Joined:
    Oct 26, 2016
    Posts:
    3
    I'm trying to create this same effect, Did you manage to find a solution for it?