UI text randomly changing sizes

Started by akasoor, April 26, 2024, 08:55:52 AM

Previous topic - Next topic

akasoor

I'm testing things before I make a mod and I have strange problem.

I'm trying to simply display text in upper-right corner of the screen. Code looks like that:
Rect labelRect = new Rect(UI.screenWidth - 200f, 20f, 190f, 30f);
Widgets.Label(labelRect, "Test text");

...and it works, text displays but have very inconsistent size (or style?), and this behaviour is somehow connected to position of a camera.
When camera is near center of the map, text displays in small font (similar to debug console text style), but when I move camera to any edge of the map, text changes style to bigger font (similar to temperature, time, weather style text).

I attached picture how this looks.
So what am I doing wrong in those two lines of code?


akasoor

Soo I will answer my own question.

Don't use "Widgets.Label()".

Use "GUI.Label()".

The End.