【发布时间】:2019-07-20 17:43:59
【问题描述】:
我正在使用 Unity 2018。 我有输入框和 2 个按钮。
当我单击按钮时,预期的行为是字段内的计数器会相应更改。例如:
{
int current_value = int.Parse(this.craftOrderInput.text);
if(current_value>0)
this.craftOrderInput.text = (current_value - 1) + "";
}
但这显然失败了,因为(current_value - 1) + ""; 是一个字符串,但输入字段需要一个整数。像this.craftOrder.text = (current_value - 1) ; 这样设置整数显然无法编译,因为文本组件需要一个字符串。
我想先试试 Unity 论坛,但我不能在那里提问,因为我的写作风格让他们想起了垃圾邮件。
tldr;如何在 Content Type 设置为 Integer 的情况下设置 inputfield 的 int 值?
【问题讨论】:
标签: unity3d