c# - 如何更改 guilayout.label 字体大小?

标签 c# unity3d

private void OnGUI()
    {
        GUIStyle myStyle = new GUIStyle();
        myStyle.fontSize = 20;

        GUILayout.BeginVertical(GUI.skin.box);
        GUILayout.Label("Replacing");
        GUI.Label(new Rect(650, 650, 300, 50), "HELLO WORLD", myStyle);
    }

我看到了 Replacing 标签,但它的字体非常小。所以我想测试使用新的 Rect 更改大小,但我在任何地方都看不到 HELLO WORLD。

最佳答案

我正在使用两个选项: 这个

GUIStyle headStyle = new GUIStyle();
headStyle.fontSize = 30; 
GUI.Label(new Rect(Screen.width / 3, Screen.height / 2, 300, 50), "HELLO WORLD", headStyle);

或者这个

GUI.skin.label.fontSize = 30;
GUILayout.Label("HELLO WORLD", GUILayout.Width(300), GUILayout.Height(50)))

关于c# - 如何更改 guilayout.label 字体大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52010746/

相关文章:

c# - 优雅的 Win32 无窗口进程终止

android - 在Unity3D生成的 "Android class name"中找到 "AndroidManifest.xml"

c# - 将默认凭据与 Exchange Web 服务一起使用

c# - .net核心: How to pass parameters and run Azure data factory pipeline from C# Code?

c# - 删除 HttpContext.Current.Session

c# - 程序类型已经存在:com.android.installreferrer.api.InstallReferrerClient $ 1

c# - 如何将服务注入(inject)AutoMapper?

C# - 我如何让 2 个游戏对象在统一中始终具有相同的 y 值

c# - 在 Unity 中从 Quaternion 和 Vector3 获取新位置

c# - 如何使用 C# 在 Excel 中绘制数据点?