Node created at runtime show up in Creator and got saved to the scene

Node created at runtime show up in Creator and got saved to the scene
0.0 0

#1

I use this code to create a node dynamically at runtime.

this._transitionNode = new cc.Node();
this._transitionNode.parent = this.target;
this._transitionNode.zIndex = -1;
this._transitionNode.opacity = 0;
this._transitionSprite = this._transitionNode.addComponent(cc.Sprite);

It works great but when it runs, the node being created show up in Creator and got saved into the scene. Is it a creator bug?


#2

Make sure you’re not using executeInEditMode flag or inherit from basic components as cc.Sprite (because they all use this flag).
Try wrapping it with if( !CC_EDITOR) check