Search Unity

TextMesh Pro Limit on TextMeshPro character count

Discussion in 'UGUI & TextMesh Pro' started by ItzHyper_, Apr 15, 2020.

  1. ItzHyper_

    ItzHyper_

    Joined:
    Nov 3, 2019
    Posts:
    1
    So I'm creating a tutorial on my game where text appears on scrren, as dialogue, letter by letter. O accomplish this by getting the character count and adding each one sequentially. However, once I got 36 characters it just cuts of and won't display any more. This has me stu.ped, so if anyone could help that's be awesome! Also, here's the tutorial I based it off of for context:
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Not sure if you are following a similar implementation and using the .maxVisibleCharacter to reveal the characters overtime.

    If not, take a look at the example 17 - Old Computer Terminal and related scripts which is included in the TMP Examples & Extras.

    The idea behind the implementation used in those examples is to set the .text property to the full and final text. This ensures all internal buffers are allocated for the full text (which would avoid any potential issues like you might be running into at character 36 which would correspond to the buffer size (power of two) of whatever the initial text you set was) but more importantly avoid string allocations resulting from string concatenation as you build the string one character at a time which is what we are trying to avoid here in those examples.

    So take a look at the Old Computer Terminal which does exactly what you seek to do. See the following thread as well for other examples.