我现在加了个destroyed的判断就不出现这个bug了。说明确实是该对象已被删除了,但仍在执行tween。
我的代码是在收到socket的消息后调用destroyChildren,这时tween没有执行完,有很大几率出这个bug。
代码如下
Laya.Tween.to(spring2,{scaleX:1.0,scaleY:1.0},500,null,Laya.Handler.create(this,function(){
if(!spring2.destroyed){ // 添加判断后就不出bug了
Laya.Tween.to(spring2,{alpha:0},300,null,Laya.Handler.create(this,function(){
if(callback){
callback();
}
spring1.destroy();
spring2.destroy();
ani.destroy();
}),1200);
}
}));
但是写个不联网的demo没出现这个问题。也不清除为什么destroy后仍在执行tween
@xiaosong