大神们,新手一枚求助啊。

  代码如下: 
   var child =this.node.children[0];
    var partic=child.getComponent(cc.ParticleSystem);
    cc.log(partic.active);
    partic.active=true; 

输出都能正常。为什么 partic.active=true; 就要报错:
Cannot set property active of #<cc_ParticleSystem> which has only a getter

试试
partic.node.active=true;

这样确实不报错。但是partic这是一个粒子系统。我想让粒子运行起来。所以partic.node.active=true;没有用处

partic 是cc.ParticleSystem组件,并没有active属性 partic.node才有active属性

1赞

查了有active属性。而且cc.log出来也是得到false。

你的报错不是告诉你了吗,没有set函数 只有get函数

/**
 * !#en Indicate whether the particle system is activated.
 * !#zh 是否激活粒子。
 * @property {Boolean} active
 * @readonly
 */
active: {
    get: function () {
        return this._sgNode ? this._sgNode.isActive() : false;
    },
    visible: false
}

原来是这个意思,
那只能先设置partic.node.active=false。粒子系统设置playonload 为ture。
需要的时候partic.node.active=ture。但是感觉好麻烦。没有代码能直接控制粒子系统的播放的吗

好吧。找到方法了。resetSystem();杀死粒子,重启。也可以用来作为启动函数