issue when overflow is set as page

hi, @Stephan_B
please check this.

Unity : 2018.4.13f1
Textmesh pro: 1.4.1 / 1.5.0 preview 2 tested

  1. the PageInfo is not updated after ForceMeshUpdate is called, my workaround is waiting for one frame.

  2. the PageInfo[page].lastCharacter is wrong when the text is end of “\n” (maybe the same on other escape characters ), for instance

text: “This is a test string”
textInfo,characterCount: 21
pageInfo.firstCharacterIndex: 0
pageInfo.lastCharacterIndex: 20

text: “This is a test string\n”
textInfo,characterCount: 22
pageInfo.firstCharacterIndex: 0
pageInfo.lastCharacterIndex: 0 => should be 21

  1. the character index is not correct for
    tag, because
    is replaced by “\n”, for instance

text: "
This is a test string"
textInfo,characterCount: 22 => correct
pageInfo.firstCharacterIndex: 0
pageInfo.lastCharacterIndex: 21 => correct
textInfo.characterInfo[0].character = “\n” => correct
textInfo.characterInfo[0].character.index = 0 => should be 3

text: “<color=#ff00ff>This is a test string”
textInfo,characterCount: 21 => correct
pageInfo.firstCharacterIndex: 0
pageInfo.lastCharacterIndex: 20 => correct
textInfo.characterInfo[0].character = “T” => correct
textInfo.characterInfo[0].character.index = 15 => correct

any luck?

bump

bump

@Stephan_B We really need your help)
Unity 2018.3.4, TMP 1.30 verified
PageInfo lastCharacterIndex equals 0 in some cases

Please test using the latest release which is version 1.5.0-preview.14.

It is not compatible with Unity 2018.3.4

Error:

Library\PackageCache\com.unity.textmeshpro@1.5.0-preview.14\Scripts\Editor\TMPro_FontAssetCreatorWindow.cs(11,19): error CS0234: The type or namespace name ‘TextCore’ does not exist in the namespace ‘UnityEditor’ (are you missing an assembly reference?)

Can you suggest another version of TMP?

Versions 1.4.1 and 1.5.0.1 don’t help neither

That issue still break my brain!

I know I’m late to the party, but I ran into this too. Can anyone confirm this as a fix?
in TMPro_Private.cs
I changed this on line 3263

 else if (m_characterCount == totalCharacterCount - 1)
                        m_textInfo.pageInfo[m_pageNumber].lastCharacterIndex = m_characterCount;

to this

 else if (m_characterCount == totalCharacterCount)
                        m_textInfo.pageInfo[m_pageNumber].lastCharacterIndex = m_characterCount;

The code seems to revert after restart, but I’m not sure it recompiles when it reverts, because I haven’t had any issues since I’ve changed it. The lastCharacterIndex is set to 0 by default, and the if/else block they have setup would allow something fall through and just stay at that default.

Just came across this - PageInfo.lastCharacterIndex will return 0 if the text’s string ends with a newline character. This is a very easy issue to lose a lot of time to, would greatly appreciate it getting fixed!