2
2
2abuza2016-09-25 17:00:08
JavaScript
2abuza, 2016-09-25 17:00:08

How to make text auto-grow in Unity 3d?

I have a GUI.Button that grows or shrinks depending on the screen size, but the text it contains stays the same. I found only how to change the text size in GUI Skin manually, but if the button increases, then the text in it increases, if the button decreases, then the text decreases accordingly. (Unity3d, javascript)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-09-25
@2abuza

public Font font;
private GUIStyle guiStyle;
guiStyle = new GUIStyle();
guiStyle.font = font;
guiStyle.fontSize = 20;
GUI.Button(new Rect(a,b,c,d), "btnTEXT", guiStyle);
well, then on resize change guiStyle.fontSize proportionally
otherwise it seems like nothing

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question