KeyNotFoundException: Cannot find Delegate Adapter for:TimeManager.OnTimedEvent(Object source, ElapsedEventArgs e), Please add following code:
appdomain.DelegateManager.RegisterMethodDelegate<System.Object, System.Timers.ElapsedEventArgs>();
在Unity项目中ILRuntimeWrapper.cs的void RegistDelegate()函数中添加 下面这段代码
...
public class ILRuntimeWrapper : UnitySingleton<ILRuntimeWrapper>
...
void RegistDelegate()
{
...
appdomain.DelegateManager.RegisterMethodDelegate<System.Object, System.Timers.ElapsedEventArgs>();
...
}
appdomain.DelegateManager.RegisterDelegateConvertor<System.Timers.ElapsedEventHandler>((act) =>
{
return new System.Timers.ElapsedEventHandler((sender, e) =>
{
((Action<System.Object, System.Timers.ElapsedEventArgs>)act)(sender, e);
});
});
...
}
...
在热更新ILRuntime中使用参考资料1 的 开始 倒计时的方法 可以实现 每一秒 执行 ,当unity 不执行