using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DelegateDemo : MonoBehaviour {
public delegate void Del(string msg);
void Start(){
Del SampleDel;
SampleDel = PrintMsg;
SampleDel += Debug.Log; //using plus sign we can subscribe multiple methods to trigger events.
SampleDel("Hello Shrinath..."); //when this is called, all the methods subscribed to this delegate gets called
}
void PrintMsg(string msg1){
Debug.Log ("msg : " + msg1);
}
}