Overlapping text when inserting Player Display name

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
LilGames
Posts: 29
Joined: Fri Jul 07, 2023 6:38 pm

Overlapping text when inserting Player Display name

Post by LilGames »

Hi. I found the discussions elsewhere in this forum about how to show display names, however I am experiencing a bug:

Example conversation text set in the DB/inspector:

It's ... uh ... my ... my name is [lua(Actor["Player"].Display_Name)]. This text is now overlapping!

The result when playing the game is:
uds_overlap-bug.png
uds_overlap-bug.png (24.55 KiB) Viewed 233 times
When I view the text field via the inspector at that time (WHILE playing) it looks like this:
It's ... uh ... my ... my name is Wretched Human . This text is now overlapping!

See the space after "Human" that got inserted? If I copy-paste that text from the inspector, into NotePad, there seems to be a "new line" or carriage return in there:

It's ... uh ... my ... my name is Wretched Human
. This text is now overlapping!


My text field is a TMPro textfield and yes, Rich Text is enabled.
Help! ;)
User avatar
Tony Li
Posts: 21680
Joined: Thu Jul 18, 2013 1:27 pm

Re: Overlapping text when inserting Player Display name

Post by Tony Li »

Hi,

Check the TextMeshProUGUI's Overflow property. It should be set to Overflow.

If your text has a carriage return (<CR>) character but not a line feed (<LF>), TextMesh Pro will start typing at the beginning of the line but it won't move down one line.
LilGames
Posts: 29
Joined: Fri Jul 07, 2023 6:38 pm

Re: Overlapping text when inserting Player Display name

Post by LilGames »

Overflow is already on and multi-line text appears normally if I don't use that special lua code tag.

I'm trying to find the scripts where the text gets converted and assigned but having a hard time figuring out where to look. :D
User avatar
Tony Li
Posts: 21680
Joined: Thu Jul 18, 2013 1:27 pm

Re: Overlapping text when inserting Player Display name

Post by Tony Li »

Hi,

I don't think the [lua(code)] tag is adding the line feed. It's much more likely that there's a line feed hiding in your Player actor's Display Name field.

BTW, if the player is the conversation's actor, you can use [var=Actor] instead of [lua(Actor["Player"].Display_Name)]. It will probably still have the same problem, though, since I suspect the problem is in the Display Name field's value.
LilGames
Posts: 29
Joined: Fri Jul 07, 2023 6:38 pm

Re: Overlapping text when inserting Player Display name

Post by LilGames »

You are probably correct. I checked and could see no extra characters in the display name, but I clicked Delete a couple times anyways and now everything displays correctly!

Also thanks for the simplification tip.
User avatar
Tony Li
Posts: 21680
Joined: Thu Jul 18, 2013 1:27 pm

Re: Overlapping text when inserting Player Display name

Post by Tony Li »

Glad to help!
Post Reply