How to find weather the function execution completed or not

I want to find the completion of a function to make a “loading” pop up while the completion of funtion execution how can ikeep it?help me.

hii… You can set one boolean variable at the end of function so that you can find function is executed .

And in Update you can check that boolean variable whether it is set or not and do further action.


Since you want to call a method if the another method gets to the end you might as well pass that method as argument.

void CallOnCondition()
    Debug.Log("Calling, other method reached the end");

void MainCallingMethod(Action action)
    // Doing stuff here and there
    for(int i = 0; i < 10; i++ ){
    // I am done with my 1000 lines of smart code based on heavy and advanced algorithms


// Lets try it
void Start(){

This is using delegate, notice the lack of () when passing the method. This is because we are passing the address of the method and we are not calling it. But action(); is the call so it needs the parenthesis. In this case, action is a reference to the actual method we wish to call. It also means you can pass any method.

And you will probably come back saying that the method can not be found and you are maybe missing a namespace or something of the kind, so add this on top:

 using System;