Have bark dialogue resize to actual text width when text wraps

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
pciol
Posts: 5
Joined: Thu Jan 07, 2021 12:29 pm

Have bark dialogue resize to actual text width when text wraps

Post by pciol »

Hello,

I'm running into an issue that when text wraps in a bark the dialogue background does not resize to the actual text width and consequently an unpleasant visual.

In the attached image, which is a screenshot taking from the scene editor while the game was paused, one can see that there is some extra spacing (which I figure has something to do with the way wrapping works). I'd like to know how to get the dialogue background to match the actual text width. Is there a "quick fix" or does one need to take another approach to how the bark component is setup all together?

For reference what you see in the attached image is a very lightly modified version of the "Bubble Template Standard Bark UI" prefab - all I've done is change the font and the the image on the UI component.

Thanks,
Attachments
Screenshot 2021-01-08 154024.png
Screenshot 2021-01-08 154024.png (14.09 KiB) Viewed 235 times
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Have bark dialogue resize to actual text width when text wraps

Post by Tony Li »

Hi,

That's the way Unity UI works, unfortunately. It's not specific to the Dialogue System. When Text or TextMeshProUGUI reaches a point where it needs to wrap, it wraps but doesn't readjust the rect transform size. Can you center your text? This way an equal amount will be on either side, although the lines won't be left-justified.
pciol
Posts: 5
Joined: Thu Jan 07, 2021 12:29 pm

Re: Have bark dialogue resize to actual text width when text wraps

Post by pciol »

I noticed that centering can make the effect less-pronounced, but I'd really like to have the text left-justified. Surely someone else has run into this problem and come up with a solution?
Post Reply