I have come across some unexpected behaviour when using the SpriteKit Scene Editor, and wonder if anyone else is having the same issue.
I created a sprite in a scene
Hi,I had this same problem. Below is my solution:
override func didMove(to view: SKView) {
sleep(1)
}
However,this is not good way. I hope I can help you temporarily. If you slove this problem or find a better solution, please reply me, thank you.
Sadly, this problem persists in Xcode10. If you are using custom classes, either directly or as the parent node, the easiest way to fix this is to add self.isPaused = false
to the init?(coder aDecoder: NSCoder)
method of your custom class.
I asked a similar question just the other day: XCode 9: SKEditorReference doesn't allow animations?
The only way I was able to get this to work was to put the isPaused on the exact sprite node I was trying to animate (within a ref node - I had created an entire sks scene/file and drag-dropped that into my main scene).
I tried isPaused=false at the top level, main scene didMove to view to no effect, and then added isPaused=false to the main reference node, to no effect. It worked only when I added isPaused=false the actual sprite I was trying to animate. I removed isPaused=false from the the main & ref nodes, and as long as it was still on the sprite node (within the ref node) I was trying to animate: success.
Bottom line seems to be that isPaused=false is required on any sprites within a reference node.
I had this same problem and it was driving me crazy. I tried setting the .isPaused on the scene and on the individual sprites. Nothing worked except the insert breakpoint method. That is not a solution.
What I discovered was if I set the is paused to true and false (which is the value I wanted) then it worked for all the sprites.
override func didMove(to view: SKView) {
self.isPaused = true
self.isPaused = false
}
This is a pretty annoying bug in scene editor that should be fixed.