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<Button>();
btn.onClick.AddListener(delegate { this.OnClickBtn(5); });
}
//button点击传参
public void OnClickBtn(int num)
{
Debug.Log("参数为:" + num);
GameObject go = Instantiate<GameObject>(Resources.Load<GameObject>("Prefabs/TestOne"));
TestOne tt = go.GetComponent<TestOne>();
if (tt == null)
{
tt = go.AddComponent<TestOne>();
}
OnClose();
}
public void OnClose()
{
Destroy(gameObject);
}
}