using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class CallbackUsingActionAndLambdaDemo : MonoBehaviour {
void Start(){
DoWork ((String result) => Debug.Log (result)); //passing the executable code to DoWork() as a callback (after doing work in DoWork(), the code which has been sent will be executed)
}
public void DoWork(Action<string> callback){
bool isWorkDone;
//do work here
isWorkDone = true;
if (isWorkDone)
callback ("yes work is done successfully");
else
callback ("sorry work is not done");
}
}