Search code examples
swiftios8sprite-kitframe-rate

Change FPS of Sprite-Kit Game?


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


Solution

  • Set the SKView's frameInterval to the desired value.

    Ref: https://developer.apple.com/library/mac/documentation/SpriteKit/Reference/SKView/index.html#//apple_ref/occ/instp/SKView/frameInterval

    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.