Reputation: 4969
Is it possible to change the FPS of a Sprite-Kit game? If it is possible, how can I implement this into my code?
For example, if a user wants to conserve battery the game can change the FPS from 60 (default value) to 30 or 20.
Thanks for helping
Upvotes: 1
Views: 1828
Reputation: 2680
let gameView = SKView()
if #available(iOS 10.0, *) {
gameView.preferredFramesPerSecond = 30
} else {
gameView.frameInterval = 2 //Deprecated
}
Upvotes: 1
Reputation: 1708
Set the SKView
's frameInterval
to the desired value.
Setting the interval to 2 will cause half the default frame rate. (It is an integer though so it appears that the only option would be to cut the frame rate by half, third, fourth, etc.
Upvotes: 3