Skip to content

Commit

Permalink
Adjust the enable time (cocos#3075)
Browse files Browse the repository at this point in the history
* Adjust the enable time

* review code
  • Loading branch information
VisualSJ authored and jareguo committed Aug 13, 2018
1 parent c1af913 commit 4d63ca3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cocos2d/core/utils/base-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -1133,10 +1133,7 @@ var BaseNode = cc.Class({
cc.warnID(1623);
}
}
var shouldActiveNow = this._active && !!(newParent && newParent._activeInHierarchy);
if (this._activeInHierarchy !== shouldActiveNow) {
cc.director._nodeActivator.activateNode(this, shouldActiveNow);
}

if (CC_EDITOR || CC_TEST) {
var scene = cc.director.getScene();
var inCurrentSceneBefore = oldParent && oldParent.isChildOf(scene);
Expand Down Expand Up @@ -1176,6 +1173,10 @@ var BaseNode = cc.Class({
_Scene.DetectConflict.afterAddChild(this);
}

var shouldActiveNow = this._active && !!(newParent && newParent._activeInHierarchy);
if (this._activeInHierarchy !== shouldActiveNow) {
cc.director._nodeActivator.activateNode(this, shouldActiveNow);
}
},

_instantiate (cloned) {
Expand Down

0 comments on commit 4d63ca3

Please sign in to comment.