- Home /
UI Text Font Size not working with World Space Canvas Scaler
Hello, I'm trying to make a world space UI Canvas, and notice that having the Canvas Scaler component enabled makes all Text elements no longer respond to font size. Is this a bug? If not, what is the intended method to adjust font size while using the Canvas Scaler component?
Steps to reproduce issue:
Create a Canvas (GameObject>UI>Canvas)
Set Canvas.RenderMode to World Space
Set the Canvas's Rect Transform width & Height to appropriate world space values (2 x 1 meter)
Add a Text Object to the Canvas (GameObject>UI>Text)
Adjust Text size and pos to fit within the canvas (Pos: 0,0,0 width:2 Height: 1)
Set the Canvas Scaler's Dynamic Pixel Unit to a reasonable value to see the font (3000)
The Text should appear on screen, but no longer respond to adjustments to font size.
I have the same problem. The higher you raise DPPU, the smaller the maximum font size you can set. I used scale of transform and low DPPU.
Answer by QuantumCookies · Apr 15, 2018 at 05:34 PM
The way I fixed this issue was adjust the dynamic pixel reference up and down to change the size of the text.
Do you think it Unity's intent to only allow one font size per canvas?
Answer by apantev · Oct 08, 2018 at 02:12 AM
"The higher you raise DPPU, the smaller the maximum font size you can set. I used scale of transform and low DPPU." - @Splendidus
The above comment had the answer I was looking for.
So for me I set Dynamic Pixel Per Unit to 1 and set my X and Y scale to 0.01
So you are saying you are scaling every text element to change the appearance of it's font size?
Wouldn't this also require you to change the bounds of the rect transform to make it fit the new scale.
Wouldn't this also affect the aliasing of the text edge, by over or under sampling the scaled text?
Wouldn't this make adjustments to several existing text elements extremely painful?
Do you believe this wonky behavior is Unity's intended solution for dealing with text in a world-space UI? If so, why not mention it in the documentation?
I think it's much more likely that DPPU component is broken when used with world-space canvas.
Since starting this thread, I have stopped using DPPU completely. I design a canvas at a scale of one-pixel-per-meter, then scale it down to fit world-scale. I keep all my Text at scale 1, and use 'font size' to adjust the text size. I believe this to be the proper solution until Unity fixes DPPU.
Your answer
Follow this Question
Related Questions
How can I set the UI Text font size higher than 300px ? | Unity 5.4 2 Answers
How to change the size of a GUI text (in a script)? 2 Answers
Changing Font Size of GUI Text With Code? 1 Answer
Dynamic Font Size in mobile devices? 0 Answers
How to build a bestfit font size for a group of UI Text 3 Answers