Invoke in C# / Unity

在VC# 裡,Invoke指的是 Form.Invoke(delegate d, object[] args)

用於multi Thread 對UI的存取,當其他Thread使用Invoke後,參數內的delegate會自動尋找Form擁有者Thread去執行它

Example :

在Unity裡,Invoke 是個ExcuteFunc 的概念(源自BZ Jass),即為非同步執行function

定義為 MonoBehaviour.Invoke(string methodName, float time);

用途為等待float秒後執行string名子的function

另有 InvokeRepeating(string methodName, float time, float repeatRate);

IsInvoking (string methodName);

CancelInvoke (string methodName);

此外

UnityEvent 裡也有Invoke() ,是用於觸發 Event