unity的鼠标点击封装(继承可直接用)

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

public class GameManager : MonoBehaviour
{

    public string str;

    void Start()
    {
        Btn2DChuShiHua();
    }
    void Btn2DChuShiHua()
    {
        GameObject[] btns = GameObject.FindGameObjectsWithTag(str);

        List btnsName = new List();
        for (int i = 0; i < btns.Length; i++)
        {
            btnsName.Add(btns[i].name);
        }
        foreach (string btnName in btnsName)
        {
            GameObject btnObj = GameObject.Find(btnName);
            Button btn = btnObj.GetComponent

你可能感兴趣的:(unity的鼠标点击封装(继承可直接用))