当前位置:网站首页>获取委托中注册的方法
获取委托中注册的方法
2022-07-27 18:22:00 【心前阳光】
知识点
Delegate的GetInvocationList方法返回一个数组,该数组存储添加的方法
实例
using UnityEngine;
using UnityEngine.Events;
public class TestEvent : MonoBehaviour
{
UnityAction action;//无参无返回值 委托
event UnityAction eventAction;//事件
void Start()
{
action += Print;
action += Print;
//打印调用列表
foreach (var item in action.GetInvocationList())
{
Debug.Log(item.Method);//打印方法名
}
eventAction += Print;
eventAction += Print;
//打印调用列表
foreach (var item in eventAction.GetInvocationList())
{
item.Method.Invoke(this, null);//执行方法
}
}
void Print()
{
Debug.Log("123");
}
}
边栏推荐
- MySQL log query log
- 程序放在哪儿?
- Is it safe for CICC fortune to open an account? What is the use of opening an account
- 做测试, 就得去大厂,内部披露BAT大厂招聘“潜规则”
- RK3399平台入门到精通系列讲解(导读篇)21天学习挑战介绍
- [Numpy] 数组索引和切片
- Technology blog and tutorial
- Why does Alibaba prohibit more than three forms from joining?
- Things about stack migration
- 【防抖与节流】
猜你喜欢

如何监控NVIDIA Jetson的的运行状态和使用情况

Academic sharing | Tsinghua University, Kang Chongqing: power system carbon measurement technology and application (matlab code implementation)

人家这才叫软件测试工程师,你那只是混口饭吃(附HR面试宝典)

一文了解Pycharm快捷键
![[Numpy] 数组属性](/img/eb/a27c24deeb7951828cdfbaa88c059c.png)
[Numpy] 数组属性

JVs official account login configuration

五大知名人士对于AI的忧虑
![[efficiency] abandon notepad++, this open source substitute is more awesome!](/img/41/495bbe4d1e6d953ba5c4d8984f81e7.jpg)
[efficiency] abandon notepad++, this open source substitute is more awesome!

做测试, 就得去大厂,内部披露BAT大厂招聘“潜规则”

Innovative cases | the growth strategy of digitalization of local life services and upgrading of Gaode brand
随机推荐
从0开始写bootloader
Openresty Lua resty DNS domain name resolution
浅析即时通讯移动端 IM 开发中登录请求的优化
EasyCVR平台添加RTSP设备时,出现均以TCP方式连接的现象是什么原因?
adb shell ls /system/bin(索引表)
2022-07-19 网工进阶(二十)BGP-路由优选、路由优选逐条分析
Summary of simple topics
What configurations are required to connect polardb and redis?
Is it safe for CICC fortune to open an account? What is the use of opening an account
【数据集显示标注】VOC文件结构+数据集标注可视化+代码实现
JVS私有化部署启动失败处理方案
[deep learning] pytoch tensor
Using dataX to realize efficient synchronization of MySQL data
认识网络模型数据的封装和解封装
MySQL basic queries and operators
海康设备接入EasyCVR,出现告警信息缺失且不同步该如何解决?
十年测试老鸟聊聊移动端兼容性测试
软件测试面试题:字符串 “axbyczdj“,如果得到结果“abcd
Xdc 2022 Intel technology special session: Intel Software and hardware technology builds the cornerstone of cloud computing architecture
金仓数据库 KingbaseES异构数据库移植指南 (2. 概述)