Skip to content

Commit

Permalink
fire event in _addComponentAt (cocos#8714)
Browse files Browse the repository at this point in the history
  • Loading branch information
gameall3d authored Jun 10, 2021
1 parent 8ceb4be commit 518c760
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cocos/core/scene-graph/base-node-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ export function baseNodePolyfill (BaseNode) {

comp.node = this;
this._components.splice(index, 0, comp);
if ((EDITOR || TEST) && legacyCC.engine && (this._id in legacyCC.engine.attachedObjsForEditor)) {
legacyCC.engine.attachedObjsForEditor[comp._id] = comp;
if (EDITOR && EditorExtends.Node && EditorExtends.Component) {
const node = EditorExtends.Node.getNode(this._id);
if (node) {
EditorExtends.Component.add(comp._id, comp);
}
}
if (this._activeInHierarchy) {
legacyCC.director._nodeActivator.activateComp(comp);
Expand Down

0 comments on commit 518c760

Please sign in to comment.