【发布时间】:2015-09-09 13:26:33
【问题描述】:
在我的游戏中,我想要一个按钮,单击该按钮会覆盖字符串。然后,该字符串将显示在上面的某些文本中。到目前为止,它变得非常错误......
这是我使用的代码(在 C# 中):
using UnityEngine;
using System.Collections;
public class ConnectGUI : MonoBehaviour {
private string map = "No map selected.";
// Use this for initialization
void Start () {
}
void OnGUI () {
GUI.Label(new Rect(10,10,200,90), "Map selected: ", map);
if(GUI.Button (new Rect(10,50,90,20), "Pier")){
map = "Pier";
}
}
// Update is called once per frame
void Update () {
}
}
有什么想法吗?
【问题讨论】:
标签: c# user-interface unity3d unityscript