当前位置:网站首页>Unity_代码方式添加绑定按钮点击事件
Unity_代码方式添加绑定按钮点击事件
2022-04-23 14:26:00 【黑狗向前跑】
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MainPanel : MonoBehaviour
{
private void Awake()
{
//代码方式绑定 点击事件
transform.Find("BtnTargetList").GetComponent<Button>().onClick.AddListener(OnTargetListButtOnClick);
transform.Find("BtnTargetAdd").GetComponent<Button>().onClick.AddListener(OnTargetAddOnClick);
}
//点击事件
private void OnTargetListButtOnClick()
{
UiManager.Instance.TargetListPanel.Show();
}
//点击事件
private void OnTargetAddOnClick()
{
Debug.Log("香蕉船");
}
}
版权声明
本文为[黑狗向前跑]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_42137574/article/details/124278485
边栏推荐
- LLVM - 生成加法
- 关于UDP接收icmp端口不可达(port unreachable)
- 51单片机的花卉、农田自动浇水灌溉系统开发,Proteus仿真,原理图和C代码
- Uni app message push
- 1分钟看懂执行流程,永久掌握for循环(附for循环案例)
- Proteus simulation design of four storey and eight storey elevator control system, 51 single chip microcomputer, with simulation and keil c code
- C语言知识点精细详解——数据类型和变量【2】——整型变量与常量【1】
- flannel 原理 之 子网划分
- js 格式化时间
- Usage of BC
猜你喜欢

基于TLC5615的多路可调数控直流稳压电源,51单片机,含Proteus仿真和C代码等

C语言知识点精细详解——数据类型和变量【2】——整型变量与常量【1】

AT89C52 MCU frequency meter (1Hz ~ 20MHz) design, LCD1602 display, including simulation, schematic diagram, PCB and code, etc

C语言知识点精细详解——初识C语言【1】

Processing MKDIR: unable to create directory 'AAA': read only file system

c语言在结构体传参时参数压栈问题

8.2 文本预处理

1分钟看懂执行流程,永久掌握for循环(附for循环案例)

ArrayList collection basic usage

OpenFaaS实战之四:模板操作(template)
随机推荐
初识STL
初始c语言大致框架适合复习和初步认识
Nacos作为配置中心(四) 使用Demo
Use cases of the arrays class
redis 模块编程中 key value的生命周期
Four ways of SSH restricting login
TLS/SSL 协议详解 (30) SSL中的RSA、DHE、ECDHE、ECDH流程与区别
A blog allows you to learn how to write markdown on vscode
基础正则表达式
错误:无法远程查找到密钥 “428F7ECC7117F726“
SSH 通过跳板机连接远程主机
AT89C52单片机的频率计(1HZ~20MHZ)设计,LCD1602显示,含仿真、原理图、PCB与代码等
Branch statement of process control
uni-app消息推送
顺序表的操作,你真的学会了吗?
修改Firebase Emulators的默认侦听IP
Web page, adaptive, proportional scaling
TLS/SSL 协议详解 (28) TLS 1.0、TLS 1.1、TLS 1.2之间的区别
Tongxin UOS php7 2.3 upgrade to php7.0 two point two four
Mq-2 and DS18B20 fire temperature smoke alarm system design, 51 single chip microcomputer, with simulation, C code, schematic diagram, PCB, etc