-
Creator 版本:3.8.4 3.8.5
-
目标平台: edge浏览器
-
重现概率: 运行一段时间必出
start 是null, typeof start === ‘object’ 成立,然后走这里面来了, keys也是null.
出错的文件是http://localhost:7456/scripting/engine/cocos/tween/tween-action.ts
需要操作运行一段时间就会出现
Uncaught TypeError: Cannot read properties of null (reading ‘length’)
at TweenAction.update (tween-action.ts:385:48)
at Sequence.update (action-interval.ts:343:21)
at Sequence.step (action-interval.ts:137:14)
at ActionManager.update (action-manager.ts:499:49)
at TweenSystem.update (tween-system.ts:78:28)
at Director.tick (director.ts:780:38)
at Game._updateCallback (game.ts:1080:22)
at Pacer.updateCallback [as _callback] (pacer-web.ts:95:22)
at Pacer._handleRAF (pacer-web.ts:126:22)
(索引):397 ErrorEvent
这是堆栈信息
大概率是tween的目标对象被销毁了,目标对象销毁时,需要主动调用了下stop方法。
你的意思时tween对象调用stop方法是已经被销毁了就会出这个错误吗
额,不是。我的意思是调用tween函数时指定的目标被销毁了。创建缓动时,记录缓动对象let t = tween(target),然后在target被销毁/隐藏/释放的地方,调用t.stop();。
能否有比较稳定的复现方式?一段时间,大概是多久?
// 创建单个能量文字变化动画
const animtiaon_label = new Promise<void>((resolve, reject) => {
new Tween({n: single_enegry})
.to(duration,{ n: result_enegry },{
onUpdate: (t,d) => {
single_enegry_view.enegry_label.string = Math.floor(t.n) + '';
}})
.call(() => {
resolve();
})
.start();
});
大概是调用这个东西造成的,我在排查呢
