In my game, I want a button that when clicked on, overwrites a string. This string will then be displayed in some text above. So far it is going very wrong...
Here is the code ( in C#) that I use:
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 () {
}
}
Any ideas?
You've made a mistake in following line:
should be
Change the comma
,
to a plus+
;