[0]skeleton的_onAniSoundStoped清除的时候有时会报undefined错误

/**
* @internal
* 清掉播放完成的音频
* @param force 是否强制删掉所有的声音channel
*/
private _onAniSoundStoped(force: boolean): void {
for (let len = this._soundChannelArr.length, i = 0; i < len; i++) {
let channel = this._soundChannelArr[i];
if (channel.isStopped || force) {
!channel.isStopped && channel.stop();
this._soundChannelArr.splice(i, 1);
// SoundManager.removeChannel(_channel); // TODO 是否需要? 去掉有什么好处? 是否还需要其他操作?
len--; i--;
}
}
}[/i]
[i]channel 可能为空,len和数组长度不一致导致的。参考解决方法:[url=https://github.com/layabox/LayaAir/pull/1128]FIX: 一个动作中有多个声音播放时,清除时可能导致报错 by hhm-shy · Pull Request #1128 · layabox/LayaAir (github.com)[/url][/i]
QQ截图20230727164137.png
已邀请:

phhh

赞同来自:

感谢你的反馈,问题我们已经定位,你的PR已经合进引擎

要回复问题请先

商务合作
商务合作