ButtonAddListener监听按钮点击事件

ButtonAddListener监听按钮点击事件

using UnityEngine;

using System.Collections;

using UnityEngine.UI;

using UnityEngine.Events;

 

public class ButtonAddListener: MonoBehaviour

{

    public Sprite[] Sprites;//定义背景替换Sprite

    private GameObject BG;//定义按钮

    private Image bg;//定义精灵组件

    private bool TrueAndFalse;//定义bool变量

 

void Start ()

{

        //找到按钮、获取按钮的Button组件、注册按钮的点击事件

        BG = GameObject.Find("BG");

        bg=BG.GetComponent();

        BG.GetComponent

转载于:https://www.cnblogs.com/XiaoLang0/p/9690157.html

你可能感兴趣的:(ButtonAddListener监听按钮点击事件)