TextMeshPro - show next page

Hello, I’m using TextMeshPro (UI) with the overflow setting of “Page”.

I’m just trying to figure out how to make it show the next page of content, when I click a button.

It seems like a simple thing but I’ve been unable to find any examples at all. I’ve found “textInfo.pageCount” which tells me the total number of pages, but that’s all I have at the moment.

Update: I’ve found that TMP has a “pageToDisplay” variable, making this easy. All good.

Hey PoRtCuLLiS,

I’m working on a similar project and have just discovered the “Page” overflow setting.

I’ve been trying to make a simple script to attach to a button to advance the page similar to the old videos. Using the two variables you list above can you provide some guidance on how to use those in a script? I’ve been having trouble with trying to reference them properly.

Something like this

TextMeshProUGUI smstext;
int currentpage = 1;

public void ButtonNextPage()
{
        int totalpages = smstext.textInfo.pageCount;   

        if (currentpage < totalpages)
        {
            currentpage++;
            smstext.pageToDisplay++;
        }
}
2 Likes

How can we go to the next page automatically once the last character on the page is typed?