【发布时间】:2012-08-23 04:27:40
【问题描述】:
我有一个关于统一 C# 的问题:
这段代码是如何工作的:
GUI.Box(new Rect((Screen.width/2)-200,0,400,30) , "King of the hill");
虽然这个没有
GUI.Box(new Rect((Screen.width/2)-200,0,400.5,30) , "King of the hill");
我得到的错误是这样的:
The best overloaded method match for `UnityEngine.Rect.Rect(float, float, float, float)'
has some invalid arguments
此错误是否暗示 GUI.Box 采用浮点值?为什么我不能使用十进制数。
提前致谢, 西班牙文
【问题讨论】:
-
仅供参考 400.5 是文字浮动。不是文字小数,即 400.5M
-
@Surfbutler 实际上 400.5 是一个文字 double,而不是浮点数。
-
是的,你是对的(但绝对不是小数)。
标签: c# user-interface decimal unity3d