[Fixed] Changing layer of a sprite in runtime without affecting actions running on that sprite

I want to change the layer of sprite in runtime without affecting its actions. I tried removing it from parent and attaching it again with different layer but then the move action on that sprite stopped as well.

Is there any way to change the layer without removing it from parent first ?

I did a quick test and myNode->removeFromParentAndCleanup(false); seems to work for removing from the parent without stopping the actions. Basically, when removing a sprite from its parent, if cleanup is true then it will stop all that node’s actions and anything scheduled with it. cleanup is true by default, so you need to specifically say that cleanup is false.

1 Like

Thanks , your solution fixed my problem.