using UnityEngine;
using System.Collections;
public class TestNGUI : MonoBehaviour {
public UILabel mylabel;
public UIButton mybutton;
// Use this for initialization
void Start ()
{
// mylabel.text = "你好";
// mylabel.fontSize = 50; //int
//必须给Button添加UIEventListener脚本
//+=和=都可以
// UIEventListener.Get (mybutton.gameObject).onClick = ClickButton2;
UIEventListener.Get (mybutton.gameObject).onDoubleClick += ClickButton2;
}
// Update is called once per frame
void Update () {
}
// public void ClickButton()
// {
// mylabel.text = "hello";
// }
public void ClickButton2(GameObject button)
{
mylabel.text = "hello";
}
}
using System.Collections;
public class TestNGUI : MonoBehaviour {
public UILabel mylabel;
public UIButton mybutton;
// Use this for initialization
void Start ()
{
// mylabel.text = "你好";
// mylabel.fontSize = 50; //int
//必须给Button添加UIEventListener脚本
//+=和=都可以
// UIEventListener.Get (mybutton.gameObject).onClick = ClickButton2;
UIEventListener.Get (mybutton.gameObject).onDoubleClick += ClickButton2;
}
// Update is called once per frame
void Update () {
}
// public void ClickButton()
// {
// mylabel.text = "hello";
// }
public void ClickButton2(GameObject button)
{
mylabel.text = "hello";
}
}