unity3d - 如何绘制更大尺寸的标签?
问题描述
我正在使用 Unity 并尝试输出一些信息,为此我绘制标签
void OnGUI()
{
GUI.Label(new Rect(10, 10, 300, 100), FpsDecoded.ToString("D3")+" FPS Decoded" + (buffereing?" Bufferring...":""));
}.
结果我看到带有输出信息的标签,但问题是这个标签的大小非常小......
无论我做什么,都没有任何效果。我尝试应用不同的Rect
大小,但文字大小没有改变
我究竟做错了什么?
解决方案
最终我以这种方式解决了它
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);
}
推荐阅读
- bash - 如何使用 bash 根据文件名将文件放入子目录?
- pytorch - 查看张量的一部分
- r - 如何使用跨 2 个数据帧的多个条件填充列?
- r - 运行混合效应模型时出错 - 错误:每个分组因子的水平数必须 < 观察数
- c++ - 未在此范围内声明的函数和变量(c++)
- python - “TypeError:'int' object is not callable”是什么意思?
- javascript - 在导入 ES6 中获取属性
- python - pygame.camera.Camera.start() 正在创建无关的缓冲区窗口
- unit-testing - 如何使用 Ceedling/Unity/Cmock 测试嵌入式系统
- php - MySQL 更新有 2 个条件