问题
Is it possible to purposely slow down the SpriteKit scene's FPS? I was thinking if this is possible to make debugging of my game easier.
回答1:
You can do something like this as well (as an addition to crashoverride777's answer) by slowing down nodes or physics:
To make nodes going into slow-mo (you can do this per node):
self.speed = 0.2 //where self is a scene
or to do the same with physics:
self.physicsWorld.speed = 0.2 //where self is a scene
回答2:
You can change the FPS value of your SKView
when you load the first scene from your GameViewController
.
Something like:
if #available(iOS 10.0, *) {
skView.preferredFramesPerSecond = 30 // 30 FPS
} else {
skView.frameInterval = 2 // Deprecated (1 default = 60FPS so 2 would = 30 FPS)
skView.preferredFrameRate = ... // Deprecated
}
As Whirlwind so kindly pointed out in his answer:
"Also, this will not slowdown anything, you just skip frames you are seeing, eg. if you have a node that moves from point A to point B in 5 seconds, and you change preferredFrameRate to 30fps, the node will move from A to B still in 5 seconds, rather than 10. The only change you will see, is that some frames are skipped."
SKView
API reference here
来源:https://stackoverflow.com/questions/41761176/purposely-slowing-down-fps-spritekit