首页 > 解决方案 > 如何绘制更大尺寸的标签?

问题描述

我正在使用 Unity 并尝试输出一些信息,为此我绘制标签

    void OnGUI()
    {
        GUI.Label(new Rect(10, 10, 300, 100), FpsDecoded.ToString("D3")+" FPS Decoded" + (buffereing?" Bufferring...":""));
    }.

结果我看到带有输出信息的标签,但问题是这个标签的大小非常小......

无论我做什么,都没有任何效果。我尝试应用不同的Rect大小,但文字大小没有改变

我究竟做错了什么?

标签: unity3d

解决方案


最终我以这种方式解决了它

    private GUIStyle guiStyle = new GUIStyle(); //create a new variable

    void OnGUI()
    {
        guiStyle.fontSize = 20;
        string text = FpsDecoded.ToString("D3") + " FPS Decoded" + (buffereing ? " Bufferring..." : "");
        GUI.Label(new Rect(10, 10, 300, 100), text, guiStyle);
    }

推荐阅读