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

Resetting maxVisibleCharacters?

Discussion in 'UGUI & TextMesh Pro' started by Pattrigue, Mar 18, 2022.

  1. Pattrigue

    Pattrigue

    Joined:
    Nov 24, 2018
    Posts:
    55
    Hi,

    I have a typewriter effect that types out characters.
    At the end of the effect, I would like it to display all characters.
    Currently, I call
    textLabel.maxVisibleCharacters = textLabel.text.Length


    However, if the locale changes after the typing effect has finished, and the new locale's text is longer than the previous one, it will only show the amount of characters the previous locale text had since maxVisibleCharacters is set to the length of the previous text.

    Here is a gif of the problem, in case you have a hard time visualising it from my convoluted textual description: https://gyazo.com/8f89217d03622978b6fab4d387ab6717

    Is there any way to reset maxVisibleCharacters such that it is ignored/renders all characters?
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    You could set the maxVisibleCharacters to a large value when changing local. For example int.MaxValue; would work.
     
    Pattrigue likes this.
  3. Pattrigue

    Pattrigue

    Joined:
    Nov 24, 2018
    Posts:
    55
    Huh, strange fix, but it works. Thanks, appreciate it!