当前位置:网站首页>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
边栏推荐
- 微信小程序轮播图swiper
- C语言p2选择分支语句详解
- Multisim Simulation Design of DC adjustable regulated power supply of LM317 (with simulation + paper + reference)
- AT89C52 MCU frequency meter (1Hz ~ 20MHz) design, LCD1602 display, including simulation, schematic diagram, PCB and code, etc
- 全连接层的作用是什么?
- 如何5分钟上手使用OCR
- Redis cluster 原理
- Proteus simulation design of four storey and eight storey elevator control system, 51 single chip microcomputer, with simulation and keil c code
- OpenSSH的升级、版本号的修改
- Detailed explanation of SAR command
猜你喜欢
51单片机+LCD12864液晶显示的俄罗斯方块游戏,Proteus仿真、AD原理图、代码、论文等
流程控制之分支语句
KVM learning resources
API gateway / API gateway (IV) - use of Kong - Integrated JWT and fuse plug-in
微信小程序将原生请求通过es6的promise来进行优化
基于单片机的DS18B20的数字温度监控报警系统设计【LCD1602显示+Proteus仿真+C程序+论文+按键设置等】
Branch statement of process control
直流可调稳压电源的Proteus仿真设计(附仿真+论文等资料)
SHT11传感器的温度湿度监控报警系统单片机Proteus设计(附仿真+论文+程序等)
Electronic perpetual calendar of DS1302_ 51 single chip microcomputer, month, day, week, hour, minute and second, lunar calendar and temperature, with alarm clock and complete set of data
随机推荐
x509证书cer格式转pem格式
1 minute to understand the execution process and permanently master the for cycle (with for cycle cases)
Multisim Simulation Design of DC adjustable regulated power supply of LM317 (with simulation + paper + reference)
ArrayList集合基本使用
想要成为架构师?夯实基础最重要
JS progress bar, displaying the loading progress
错误:无法远程查找到密钥 “428F7ECC7117F726“
Upgrade of openssh and modification of version number
阿里研发三面,面试官一套组合拳让我当场懵逼
Flop effect
Parameter stack pressing problem of C language in structure parameter transmission
Some little records~
翻牌效果
js 格式化时间
Tongxin UOS php7 2.3 upgrade to php7.0 two point two four
On the insecurity of using scanf in VS
Notes on Visio drawing topology
ansible及常用模块的使用
XX project structure notes
TLS/SSL 协议详解 (28) TLS 1.0、TLS 1.1、TLS 1.2之间的区别