例子1:
using UnityEngine;
using System;
public class ClassA : MonoBehaviour {
public EventHandler<EventArgs> MouseEvent { get; set; }
void Start()
{
this.MouseEvent = OnTest;
}
void OnGUI()
{
if(GUI.Button(new Rect(0,0,200,200),"1111"))
{
MouseEvent(gameObject,null);
}
}
void OnTest(object sender,EventArgs e)
{
Debug.Log("-------");
}
}