使用ParticleSystem.addParticle()在apk中报错问题求助

  • Creator 版本:1.9.1

  • 目标平台: Android

  • 问题:使用node.getComponent(cc.ParticleSystem).addParticle()会在apk包和模拟器中报错:this.sgNode.addParticle is not a function,在浏览器中运行正常

  • 详细报错信息,包含调用堆栈:

2018-06-07T09:36:27.666Z - normal: Simulator: E/jswrapper (267): ERROR: Uncaught TypeError: this._sgNode.addParticle is not a function, location: src/jsb_polyfill.js:0:0

2018-06-07T09:36:27.666Z - normal: Simulator: STACK:

2018-06-07T09:36:27.666Z - normal: Simulator: [0]addParticle@src/jsb_polyfill.js:22768

2018-06-07T09:36:27.667Z - normal: Simulator: [1]removeSnakeHead@assets/Scripts/Game/Game.js:318

2018-06-07T09:36:27.667Z - normal: Simulator: [2]snakeCollisionBlockBottom@assets/Scripts/Game/Game.js:298

2018-06-07T09:36:27.667Z - normal: Simulator: [3]judgmentAndCorrection@assets/Scripts/Game/Game.js:506

2018-06-07T09:36:27.667Z - normal: Simulator: [4]snakeMove@assets/Scripts/Game/Game.js:388

2018-06-07T09:36:27.667Z - normal: Simulator: [5]update@assets/Scripts/Game/Game.js:630

2018-06-07T09:36:27.667Z - normal: Simulator: [6]anonymous@(no filename):3

2018-06-07T09:36:27.668Z - normal: Simulator: [7]invoke@src/jsb_polyfill.js:4643

2018-06-07T09:36:27.668Z - normal: Simulator: [8]updatePhase@src/jsb_polyfill.js:4753

2018-06-07T09:36:27.668Z - normal: Simulator: [9]callback@src/jsb_polyfill.js:25600

2018-06-07T09:36:27.668Z - normal: Simulator: E/jswrapper (519): [ERROR] (…\jswrapper\v8\Object.cpp, 519): Invoking function (0EE0E068) failed!

2018-06-07T09:36:27.694Z - normal: Simulator: E/jswrapper (267): ERROR: Uncaught TypeError: this._sgNode.addParticle is not a function, location: src/jsb_polyfill.js:0:0

2018-06-07T09:36:27.694Z - normal: Simulator: STACK:

2018-06-07T09:36:27.694Z - normal: Simulator: [0]addParticle@src/jsb_polyfill.js:22768

2018-06-07T09:36:27.694Z - normal: Simulator: [1]removeSnakeHead@assets/Scripts/Game/Game.js:318

2018-06-07T09:36:27.695Z - normal: Simulator: [2]snakeCollisionBlockBottom@assets/Scripts/Game/Game.js:298

2018-06-07T09:36:27.695Z - normal: Simulator: [3]judgmentAndCorrection@assets/Scripts/Game/Game.js:506

2018-06-07T09:36:27.696Z - normal: Simulator: [4]snakeMove@assets/Scripts/Game/Game.js:388

2018-06-07T09:36:27.696Z - normal: Simulator: [5]update@assets/Scripts/Game/Game.js:630

2018-06-07T09:36:27.696Z - normal: Simulator: [6]anonymous@(no filename):3

2018-06-07T09:36:27.696Z - normal: Simulator: [7]invoke@src/jsb_polyfill.js:4643

2018-06-07T09:36:27.696Z - normal: Simulator: [8]updatePhase@src/jsb_polyfill.js:4753

2018-06-07T09:36:27.696Z - normal: Simulator: [9]callback@src/jsb_polyfill.js:25600

2018-06-07T09:36:27.696Z - normal: Simulator: E/jswrapper (519): [ERROR] (…\jswrapper\v8\Object.cpp, 519): Invoking function (0EE0E068) failed!

貌似native没实现这个接口,反而有一个 addParticles(count)。

请问下你说的这个addParticles(count)接口和addParticle用法一样么,我换成你说的addParticles(count)这个接口会报not defined的错,api文档也没有看到相关的说明。

可以用addParticles(count)接口,之前是我写错了:joy:

我换成addParticles这个也不行啊,this.particle.getComponent(cc.ParticleSystem).addParticles is not a function.求指教