新手救助!节点在什么情况下runAction不会执行?

properties: {
show:cc.Prefab,
},

 onLoad () {
     var show = cc.instantiate(this.show);
     show.position = cc.v2(0,40);
     show.parent = this.node;
     show.runAction(cc.moveTo(1,cc.v2(-360,-640)));

 },

这段代码我在新建的scene里面可以正常运行,但是在其他的scene里面就不行,想知道什么情况下动作会不执行?

代码里有个
/** * !#en * Executes an action, and returns the action that is executed.<br/> * The node becomes the action's target. Refer to cc.Action's getTarget() <br/> * Calling runAction while the node is not active won't have any effect. <br/> * Note:You shouldn't modify the action after runAction, that won't take any effect.<br/> * if you want to modify, when you define action plus. * !#zh * 执行并返回该执行的动作。该节点将会变成动作的目标。<br/> * 调用 runAction 时,节点自身处于不激活状态将不会有任何效果。<br/> * 注意:你不应该修改 runAction 后的动作,将无法发挥作用,如果想进行修改,请在定义 action 时加入。 * @method runAction * @param {Action} action * @return {Action} An Action pointer * @example * var action = cc.scaleTo(0.2, 1, 0.6); * node.runAction(action); * node.runAction(action).repeatForever(); // fail * node.runAction(action.repeatForever()); // right */

这个

active属性注释有个
* 值得注意的是,一个节点的父节点如果不被激活,那么即使它自身设为激活,它仍然无法激活。

动画不播放可能是onLoad的时候他自己、或他的父节点active为false。可能啊,猜的

我检查过父节点,父节点处在激活状态。这个问题检查了很久,还有其他的可能性吗?

断点吧:sweat_smile: 如果这段在特定Scene里不执行,感觉很大可能应该是Scene逻辑影响的,不应该是这段代码有问题吧

感谢!我已经找到原因了,因为我跳转这个scene时,cc.director.pause()暂停了,所以动作不执行