Quick way to scale font size with window?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
marafrass
Posts: 36
Joined: Thu Jan 16, 2020 1:32 pm

Quick way to scale font size with window?

Post by marafrass »

Heya!

Like the title says, is there an easy way to scale the font size with the resolution of the game? Currently, my solution has been to size the font to a set resolution (1920x1080p) but to accommodate more players, I've been meaning to add in multiple resolutions. However, whenever changing these, the font size in dialogues remains set.

If it matters, I'm using TextMesh Pro for Subtitle Text and Response Text, with regular Unity Text elsewhere.
I'm also using a tweaked version of the WRPG Template, and the project is incorporated into IceBox's Adventure Creator.
(Feel free to give as specific instructions as possible - admittedly not a great programmer and I prefer visual scripting!)

Thanks!
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quick way to scale font size with window?

Post by Tony Li »

Hi,

Add a Canvas Scaler to the Dialogue Manager's Canvas(es). Set UI Scale Mode to Scale With Screen Size. Set your Reference Resolution to 1920x1080.

I like to set the Match slider all the way to Height because it's more likely that a gamer will have an ultra wide screen display than an unusually tall one.

Then adjust the sizes of your dialogue UI elements and fonts to your liking. The Canvas Scaler should keep the same relative size for different screen/window resolutions.
marafrass
Posts: 36
Joined: Thu Jan 16, 2020 1:32 pm

Re: Quick way to scale font size with window?

Post by marafrass »

You absolute legend - that immediately fixed it.
I'll try to refrain from asking general Unity support from now on, which I realize this was! Huge thanks!
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quick way to scale font size with window?

Post by Tony Li »

Glad to help! You never know when something is a quirk of the Dialogue System, so feel free to ask any time.
Post Reply