Unity UGUI 动态添加Button.OnClick()事件

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.Events;
using UnityEngine.UI;


public class ButtonOnClickTest: MonoBehaviour {

	// Use this for initialization
	void Start () {
		List btnsName = new List();
		btnsName.Add("BtnPlay");
		btnsName.Add("BtnShop");
		btnsName.Add("BtnLeaderboards");

		foreach(string btnName in btnsName)
		{
			GameObject btnObj = GameObject.Find(btnName);
			Button btn = btnObj.GetComponent

你可能感兴趣的:(Unity UGUI 动态添加Button.OnClick()事件)