The following is just an assumption.
Most likely when you call Invoke (string, float); Unity adds a dictionary of type string, object. This allows you to run any signature. On the other hand, a more general indicator makes less accuracy.
The string is probably used to reflect the object to see if this method can be added:
MethodInfo mi = this.GetType().GetMethod(methodName); if(mi != null){ // Create Delegate // Add to dictionary or other collection }
Each frame iterates through all the records and starts them if the time is done. Then deletes the record.
When you call CancelInvoke (string); it checks if the record exists and deletes it.
If you want to deal with coroutine coroutine, you can use:
IEnumerator coroutine = null; IEnumerator MyCoroutine(){ yield return null; } void Start(){ coroutine = MyCoroutine(); StartCoroutine(coroutine); StopCoroutine(coroutine); coroutine = null; }
Note that the internal functioning of this template is most likely similar to Invoke with an IEnumerator collection awaiting execution.
source share