NGUIボタンクリックパス



Ngui Button Click Pass



using System.Collections using System.Collections.Generic using UnityEngine using UnityEngine.UI public class TestTow : MonoBehaviour { private Button btn // Use this for initialization void Start() { btn = transform.Find('Panel/Button').GetComponent() btn.onClick.AddListener(delegate { this.OnClickBtn(5) }) } //button click to pass the parameter public void OnClickBtn(int num) { Debug.Log('parameters are:' + num) GameObject go = Instantiate(Resources.Load('Prefabs/TestOne')) TestOne tt = go.GetComponent() if (tt == null) { tt = go.AddComponent() } OnClose() } public void OnClose() { Destroy(gameObject) } }