using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
[System.Serializable]
public class MyEvent : UnityEvent<int, int>
{
}
public class EventTest2 : MonoBehaviour
{
MyEvent myEvent;
// Use this for initialization
void Start () {
if (myEvent == null)
myEvent = new MyEvent();
myEvent.AddListener(Ping);
}
// Update is called once per frame
void Update () {
if (Input.anyKey && myEvent != null)
{
myEvent.Invoke(1,2);
}
}
void Ping(int index0 ,int index1)
{
Debug.Log("这个是第一个参数" + index0 + "这个是第二个参数" + index1);
}
}