- Invoke
- Invoke(methodName: string, time: float): void;
methodName: 方法名
time: 多少秒后执行
- InvokeRepeating
- InvokeRepeating(methodName: string, time: float, repeatRate: float): void;
methodName: 方法名
time: 多少秒后执行
repeatRate: 重复执行间隔
还有两个重要的方法:
IsInvoking: 用来判断某方法是否被延时, 即将执行
CancelInvoke: 取消该脚本上的所有延时方法 (注意 gameObject.SetActive(false) 不起作用, 这是和 Coroutine 的区别)
来源: http://www.bubuko.com/infodetail-2575321.html