Код
using UnityEngine;
using System.Collections;
public class Labels : MonoBehaviour {
bool showLabel = false;
bool firstLabel = false;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI() {
if (GUI.Button (new Rect (10, 70, 50, 30), "Click"))
{
showLabel = true;
if (firstLabel == true) firstLabel = false;
else firstLabel = true;
}
if (showLabel)
{
if (firstLabel == true)
{
GUI.Label (new Rect (10, 10, 100, 20), "Hello World 1");
}
else
{
GUI.Label (new Rect (10, 10, 100, 20), "Hello World 2");
}
}
}
}