fix(skill): 延迟销毁技能实体以避免物理回调中直接销毁刚体
修复在物理回调中直接销毁刚体可能导致的问题,改为使用scheduleOnce延迟到下一帧销毁
This commit is contained in:
@@ -177,7 +177,12 @@ export class SkillView extends CCComp {
|
||||
(this.SConf.EType != EType.animationEnd) &&
|
||||
(this.SConf.EType != EType.timeEnd)
|
||||
) {
|
||||
this.ent.destroy(); // 技能命中次数达到上限后销毁
|
||||
// 修复:物理回调中不能直接销毁刚体,需延迟到下一帧
|
||||
this.scheduleOnce(() => {
|
||||
if (this.ent) {
|
||||
this.ent.destroy();
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
|
||||
Reference in New Issue
Block a user