xxxxxxxxxx
//declare
public delegate void Function();
public Function OnEvent;
//use
void DoSomethingOnEvent()
{
//do something
}
OnEvent += DoSomethingOnEvent;
xxxxxxxxxx
public delegate void myDelegate();
public myDelegate Del;
void start()
{
Del = () => { Debug.log(" Hello there"): };
}
void Update()
{
if(Input.getkeydown(keycode.space))
Del();
}