编辑器版本:cocos creator 3.5.0 3.4.2
将带有ParticleSystem的node instantiate , 再destroy会产生内存泄漏
操作步骤:
1、新建一个空场景
2、建立空节点,把以下脚本挂到节点上。
import { _decorator, Component, Node, instantiate } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('NewComponent')
export class NewComponent extends Component {
template: Node;
start () {
this.template = this.node.children[0];
this.schedule( ()=>{this.createNone();}, 0.1 );
}
createNone( ): void {
let node = instantiate(this.template);
node.parent = this.node;
this.scheduleOnce( ()=>{node.destroy()}, 3.0 );
}
}
3、在节点下新增Particle
4、执行后F12就会看到内存一直上升