求助大佬们,思考一上午都没解决这个问题。

节点脚本组件使用enabled=true启用时,启用数量有没有限制?
我前面建立的节点都可以用enabled启用,后面新建的节点脚本一执行到enabled=true;程序就执行不下去了,是不是有什么启用数量限制,还是其他什么原因?

请问是什么版本的编辑器哦。单听你的叙述不太理解具体是进行了什么操作。

是动态创建节点,然后动态挂载指定脚本然后执行 component.enabled = true ?

有没有具体的报错信息?
或者能有个 demo 的话最好了。。。

我用的creator版本是1.6.1
节点我直接放在canvas里,然后对该节点添加js组件,如下
cc.Class({
extends: cc.Component,

properties: {

},

// use this for initialization
onLoad: function () {

  this.enabled=false;
},
start: function(game,player){
     this.games=game;
    this.player=player;
    this.node.setPosition(this.player.char.node.position);
     if(this.games.socket.playerID==this.player.ID){
    this.games.skill1.getComponent('FreezeTime').shrink=3;
    this.games.skill2.getComponent('FreezeTime').shrink=3;
    this.games.skill3.getComponent('FreezeTime3').gainplayer(player);
  //this.enabled=true;
    }  
},

// called every frame, uncomment this function to activate update callback
  update:function(){
  },

});
将this.enabled=true;注释掉start()函数可以正常调用,但是将注释符去掉之后,再调用start();程序就卡死在这儿了,很奇怪,我前面创建的十几个点都能正常运行脚本

把start函数换个functionName试试

我去???start()函数换个名字就正常运行了,好奇葩啊,start()可能是内置的函数

http://www.cocos.com/docs/creator/scripting/life-cycle-callbacks.html#start
你猜对了

你这一上午应该把文档看一下。。。

好坑啊

有时间一定好好看