Loading a SKScene, but actions are not working

I do have a question about spritekit.

I’m drawing a sprite in a SKScene, make it really nice with children sprites and runactions (animations)

im loading the scene, copy the sprite and add it to my GameScene ( and doing nothing with the new loaded scene).

This new sprite appears on the screen, but all the SKActions (animations) don’t work anymore.
What will be the solution, of course i can do it manually, but i prefer drawing them in a scene, less work and you can see instantly the result.

if let item = SKScene(fileNamed: “upgrade•item”) {

        if let item = item.childNode(withName: "upgrade") as? SKSpriteNode {
            
            if let item = item.copy() as? SKSpriteNode {

                addChild(item)
            }
        }
    }

}

anybody ? SKRefernceNode will also not work.

Jan-Willem

I would try adding

item.isPaused = false

right after addChild(item).

Well, that worked, So thank you very much.

In case you are wondering, a similar issue, with a reference node instead of a copied node, came up in the 2D iOS Tutorial forum:

No one can explain why, but referenced nodes, and now copied nodes, seem to default to isPaused being true. Rather than battling it, it is easier to just set them to not paused when loading them.

1 Like

This topic was automatically closed after 166 days. New replies are no longer allowed.