这一篇简单讲述lambda的使用,代码如下:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test_delagate : MonoBehaviour
{
public delegate void mydelagate(string s);
/// <summary>
/// 定义一个事件
/// </summary>
public static event mydelagate mEvent;
// Use this for initialization
void Start()
{
mEvent = (s) => { print(s);};
mEvent("msg");
}
// Update is called once per frame
void Update()
{
}
}