当前位置:网站首页>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
边栏推荐
猜你喜欢
setcontext getcontext makecontext swapcontext
C语言知识点精细详解——初识C语言【1】——你不能不知的VS2022调试技巧及代码实操【2】
一款不错的工具:aardio
C语言知识点精细详解——数据类型和变量【1】——进位计数制
51单片机+LCD12864液晶显示的俄罗斯方块游戏,Proteus仿真、AD原理图、代码、论文等
常见存储类型和FTP主被动模式解析
交通灯系统51单片机设计(附Proteus仿真、C程序、原理图及PCB、论文等全套资料)
MQ-2和DS18B20的火灾温度-烟雾报警系统设计,51单片机,附仿真、C代码、原理图和PCB等
顺序表的操作,你真的学会了吗?
Matlab Simulink modeling and design of single-phase AC-AC frequency converter, with MATLAB simulation, PPT and papers
随机推荐
TLC5615 based multi-channel adjustable CNC DC regulated power supply, 51 single chip microcomputer, including proteus simulation and C code
51 MCU + LCD12864 LCD Tetris game, proteus simulation, ad schematic diagram, code, thesis, etc
tcp_diag 内核相关实现 1 调用层次
一个月把字节,腾讯,阿里都面了,写点面经总结……
QT interface optimization: double click effect
单片机的函数信号发生器,输出4种波形,频率可调,原理图,仿真和C程序
Qt实战:云曦日历篇
QT actual combat: Yunxi chat room
爬虫练习题(一)
async void 导致程序崩溃
Electronic scale weighing system design, hx711 pressure sensor, 51 single chip microcomputer (proteus simulation, C program, schematic diagram, thesis and other complete data)
常见存储类型和FTP主被动模式解析
Usage of BC
Branch statement of process control
bc的用法
Tongxin UOS uninstall php7 2.24, install php7 4.27 ; Uninstall and then install PHP 7.2.34
LLVM - 生成for循环
51 Single Chip Microcomputer Design of traffic light system (with Proteus simulation, C program, schematic diagram, PCB, thesis and other complete data)
js 格式化时间
金九银十,入职字节跳动那一天,我哭了(蘑菇街被裁,奋战7个月拿下offer)