The Invoke and Invokerepeating methods can implement deferred calls, and periodic calls
The first one is executed once and the second one is repeated
void Invoke (String methodName, float time);
The first parameter is the method name (note is in the form of a string) and is not a more convenient delegate. The second one is how many seconds to delay. Executes only once.
void Invokerepeating (String methodName, float time, float repeatrate);
Invokerepeating The second parameter is the number of seconds after which the delay begins, and the third parameter is the second of each execution interval.
The problem with these two functions is that parameters cannot be passed
If you want to pass parameters and implement deferred calls, consider using Coroutine
Startcoroutine (Fun (1, "2", 3.0f,4.0f));
IEnumerator Fun (int arg1, string arg2, float arg3, float delaysecond)
{
Yield return new waitforseconds (Delaysecond);
......
}
"Unity3d" invoke,invokerepeating, Coroutine deferred call, periodic call