...
class test : IRLMonoBehaviour
{
...
//主工程调用到热更新层 OnAwake
protected override void OnAwake()
{
...
//加入update注册
ILRuntimeWrapper.Instance.RegistUpdate(Update);
...
}
//主工程调用到热更新层 OnClose
public override void OnClose()
{
//关闭update方法注册
ILRuntimeWrapper.Instance.RemoveUpdate(Update);
}
...
public void startCountDown(string str,int time_)//time_秒数,可以改为float变量
{
Debug.Log("test startCountDown time1:" + time);
time = time_*50;//update每帧 大约为 0.02秒,20ms
Debug.Log("test startCountDown time2:" + time);
if (time > 0)
{
text.text = str;
}
}
//UI层注册update方法
void Update()
{
Debug.Log("test startCountDown Update time:" + time);
//Debug.Log("测试update的调用");
if (time == -11)
{
return;
}
[Unity][C#][ILRuntime]热更新中使用update倒计时
最新推荐文章于 2022-08-12 18:24:38 发布