使用gui文本字段进行自定义解析

时间:2019-08-08 20:10:23

标签: c# unity3d

我需要一些帮助,我尝试在带有统一GUI的C#中添加自定义分辨率更改器。

this.WeightRez = GUI.TextField(new Rect(300f, 250f, 90f, 25f), this.WeightRez, 6);

if (GUI.Button(new Rect(350f, 0f, 0f, 0f), ""))
{
    if (int.TryParse(this.WeightRez, out this.WeightRezFloat))
    {
        this.WeightRezFloat = int.Parse(this.WeightRez);
    } else {
        this.HeightRez = "ERROR";
    }
}

this.HeightRez = GUI.TextField(new Rect(260f, 0f, 90f, 25f), this.HeightRez, 6);

if (GUI.Button(new Rect(300f, 230f, 90f, 0f), ""))
{
    if (int.TryParse(this.HeightRez, out this.HeightRezFloat))
    {
        this.HeightRezFloat = int.Parse(this.HeightRez);
    } else {
        this.HeightRez = "ERROR";
    }
}

if (GUI.Button(new Rect(450f, 0f, 120f, 25f), "Set"))
{
    Screen.SetResolution(this.WeightRezFloat, this.HeightRezFloat, true);
}

它不会工作 谢谢你能帮我

0 个答案:

没有答案