using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Demo : MonoBehavIoUr
{
//无参数无返回值委托
Action action;
//带int参数的无返回值委托,参数最多16个
Action<int> action2;
// Start is called before the first frame update
void Start()
{
action += new Action(MyAction);
action();
action2 += new Action<int>(MyAction2);
action2(20);
}
public void MyAction() {
print("MyAction");
}
public void MyAction2(int num)
{
print("num = "+ num);
}
}
demo下载
https://gitlab.com/demofile1/uploadfile/-/tree/main
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。