how does invokerepeating work

can anyone help me, by explaining how invokeRepearting works. i couldn’t able to understand the last variable repeatRate. need help.

Read the documentation.

“After the first invocation repeats calling that function every repeatRate seconds.”

So, if you do InvokeRepeating(“Function”, 1.0f, 1.0f), it will call Function one second after the InvokeRepeating call and then every one second thereafter.

The difference to the regular Invoke is that InvokeRepeating repeats itself. The first argument is the initial delay, the second the time that will pass until the Invoke is called again.

For instance, to implment a countdown timer you could use:

public int timerSeconds = 60;

InvokeRepeating ("Countdown", 1, 1);

void CountDown()

{

  timerSeconds--;

  if(timerSeconds < 1)

  {

	print ("Count down finished");

	CancelInvoke("CountDown");

  }

}